Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
v = list(map(int, input().split()))

num = set(v)

if len(num) == 1:
    print(n//2)
else:
    value = []
    num = list(num)
    for i in range(len(num)):
        value.append(v.count(num[i]))

    value.sort()

    if len(num) == 3:
        print(value[0])
    elif len(num) == 2:
        print(0)
    else:
        print(sum(value.sort[0:2]))

Fixed submission:
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

e = Counter(v[::2]).most_common()
o = Counter(v[1::2]).most_common()

if len(set(v)) == 1:
    ans = n // 2
elif e[0][0] != o[0][0]:
    ans = n - e[0][1] - o[0][1]
else:
    ans = min(n - e[0][1] - o[1][1],
              n - e[1][1] - o[0][1])
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = list(map(int, input().split()))

if a % 2 == 1 or b % 2 == 1:
  print('No')
  else:
    print('Yes')

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

if a % 2 == 1 and b % 2 == 1:
  print('Yes')
else:
  print('No')

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

if a % 2 == 1 or b % 2 == 1:
  print('No')
else:
  print('Yes')

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

if a % 2 == 1 and b % 2 == 1:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):

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

for i in range(n):
    s = input()
    if s in w:
        flag = 0
        break
    else:
        w.append(s)

for i in range(1, n-1):
    if w[i][-1] != w[i+1][0]:
        flag = 0
        break

if flag == 0:
    print('No')
else:
    print('Yes')

Fixed submission:
n = int(input())
w = []
flag = 1

for i in range(n):
    s = input()
    if s in w:
        flag = 0
        break
    else:
        w.append(s)

if flag != 0:
    if w[0][-1] != w[1][0]:
        flag = 0
    for i in range(1, n-1):
        if w[i][-1] != w[i+1][0]:
            flag = 0
            break

if flag == 0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

total = a * b - (a + b - 1)

print(total)


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

total = a * b - (a + b - 1)

print(total)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

i = 0
while True:
    if S[i] != '1':
        print(S[i])
        break
    else:
        i += 1

Fixed submission:
S = input()
K = int(input())

if S[:K].count('1') == K:
    print(1)
else:
    for s in S[:K]:
        if s != '1':
            print(s)
            break

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

value = 5000000000000000
pos = 0

if k <= value:
     while True:
         if s[pos] != '1':
             print(s[pos])
             break
         else:
             pos += 1

else:
    tmp = 0
    pos = 0
    while True:
        if s[pos] != '1':
            if int(s[pos]) + tmp > k // value:
                print(s[pos])
                break
            else:
                pos += 1
                tmp += int(s[pos])

Fixed submission:
S = input()
K = int(input())

if S[:K].count('1') == K:
    print(1)
else:
    for s in S[:K]:
        if s != '1':
            print(s)
            break
Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

N, M, Q = list(map(int, input().split()))
LR = sorted([list(map(int, input().split())) for i in range(M)], key=itemgetter(0))

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

for l in range(1, N+1):
    flag = [1 for i in range(len(LR))]
    for r in range(1, N+1):
        count = 0
        for idx, lr in enumerate(LR):
            if flag[idx] and l <= lr[0] and lr[1] <= r:
                count += 1
                flag[idx] = 0
        route[l][r] = route[l][r-1] + count
        
    while len(LR):
        if LR[0][0] == l:
            LR.pop(0)
        else:
            break
for i in range(Q):
    p, q = list(map(int, input().split()))
    print(route[p][q])
    
                

Fixed submission:
import itertools

N, M, Q = list(map(int, input().split()))

route = [[0 for i in range(N+1)] for j in range(N+1)]

for i in range(M):
    L, R = list(map(int, input().split()))
    route[L][R] += 1

for i in range(1, N):
    route[i] = list(itertools.accumulate(route[i]))

for i in range(2, N+1):
    for j in range(1, N+1):
        route[i][j] += route[i-1][j]

for i in range(Q):
    p, q = list(map(int, input().split()))
    print(route[q][q]-route[p-1][q]-route[q][p-1]+route[p-1][p-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
A = list(map(lambda x: x % M, map(int, input().split())))
ans = 0
nums = []

for a in A:
    for i in range(len(nums)):
        nums[i] = (nums[i]+a) % M
        if not nums[i]:
            ans += 1
    if not a:
        ans += 1
    nums.append(a)

print(ans)

Fixed submission:
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    
    b = 0
    count = {0:1}
    ans = 0
    
    for a in A:
        b = (a+b) % M
        if b in count:
            ans += count[b]
            count[b] += 1
        else:
            count[b] = 1
            
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
nums = []

for a in A:
    for i in range(len(nums)):
        nums[i] += a
        if not nums[i] % M:
            ans += 1
    if not a % M:
        ans += 1
    nums.append(a)

print(ans)

Fixed submission:
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    
    b = 0
    count = {0:1}
    ans = 0
    
    for a in A:
        b = (a+b) % M
        if b in count:
            ans += count[b]
            count[b] += 1
        else:
            count[b] = 1
            
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
s = input()
    
if s[0] != 'A' or s[1].islower() == False or s[-1].islower() == False:
    print('WA')
elif s[2:-1].count('C') != 1:
    print('WA')
else:
    for i in range(3, len(s)-1):
        if s[i].islower() or s[i] == 'C':
            flag = 'AC'
        else:
            flag = 'WA'
            break
    print(flag)

Fixed submission:
s = input()
    
if s[0] != 'A' or s[1].islower() == False or s[-1].islower() == False:
    print('WA')
elif s[2:-1].count('C') != 1:
    print('WA')
else:
    flag = 'AC'
    for i in range(3, len(s)-1):
        if s[i].islower() or s[i] == 'C':
            flag = 'AC'
        else:
            flag = 'WA'
            break
    print(flag)

Buggy python submission (verdict: Runtime Error):
s = input()
    
if s[0] != 'A' or s[1].islower() == False or s[-1].islower() == False:
    print('WA')
elif s[2:-1].count('C') != 1:
    print('WA')
else:
    #and s[3:-2].islower() and
    for i in range(3, len(s)-2):
        if s[i].islower():
            flag = 'AC'
        else:
            flag = 'WA'
            break
    print(flag)

Fixed submission:
s = input()
    
if s[0] != 'A' or s[1].islower() == False or s[-1].islower() == False:
    print('WA')
elif s[2:-1].count('C') != 1:
    print('WA')
else:
    flag = 'AC'
    for i in range(3, len(s)-1):
        if s[i].islower() or s[i] == 'C':
            flag = 'AC'
        else:
            flag = 'WA'
            break
    print(flag)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num = n

while num % 2 != 0 or num % n != 0:
    num += 1

print(num)


Fixed submission:
a = int(input())
b = 2
x = a * b

if a < b:
    tmp = a
    a = b
    b = tmp

r = a % b
while r != 0:
    a = b
    b = r
    r = a % b

print(int(x/b))
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if a > 8 or b > 8:
    print(':(')
else:
    print('Yay!')


Fixed submission:
a, b = list(map(int, input().split()))
 
if a > 8 or b > 8:
    print(':(')
else:
    print('Yay!')

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if a > 8 or b > 8:
    print(':(')
else:
    print('Yay!')

Fixed submission:
a, b = list(map(int, input().split()))
 
if a > 8 or b > 8:
    print(':(')
else:
    print('Yay!')
Buggy python submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

def main():
    N = int(input())
    S = input()
    
    ans = float('inf')
    
    W = {'W':0, 'E':0}
    n = S.count('E')
    E = {'W':N-n, 'E':n}
    
    for s in S:
        E[s] -= 1
        
        ans = min(ans, E['E'] + W['W'])
        
        W[s] += 1
        
    print(ans)
    
if __name__ == '__main__':
    main()

Fixed submission:
N = int(input())
S = input()

min_count = N

left = {'W':0, 'E':0}
w = S.count('W')
right = {'W':w, 'E':N-w}

for i in range(N):
    base = S[i]
    right[base] -= 1
    min_count = min(left['W']+right['E'], min_count)
    left[base] += 1
print(min_count)
Buggy python submission (verdict: Runtime Error):
#include <stdio.h>

int main(void) {
    int a, b;

    scanf("%d %d", &a, &b);

    if (a <= b) {
        printf("%d\n", a);
    }
    else {
        printf("%d\n", b);
    }

    return 0;
} 

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

if a <= b:
    print(a)
else:
    print(a-1)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

X = int(input())

value = X - A

if value < 0:
    print('NO')
elif value < B:
    print('YES')
else:
    print('NO')

Fixed submission:
A, B, X = list(map(int, input().split()))

value = X - A

if value < 0:
    print('NO')
elif value < B:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
 
N = int(input())
x = list(map(int, input().split()))
half = N//2

idx = np.argsort(x)

nums = [x[idx[half-1]], x[idx[half]]]
mask = idx[:half]

for i in range(N):
    if i in mask:
        print(nums[1])
    else:
        print(nums[0])

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
center = N // 2
X_ = sorted(X)
ans = [X_[center-1], X_[center]]
center = sum(ans) / 2

for x in X:
    if x < center:
        print(ans[1])
    else:
        print(ans[0])

Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())

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

center = N // 2 - 1

for i in range(N):
    B = copy.deepcopy(X)
    B[i] = 0
    #del B[i]

    B.sort(reverse=True)

    print(B[center])

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
center = N // 2
X_ = sorted(X)
ans = [X_[center-1], X_[center]]
center = sum(ans) / 2

for x in X:
    if x < center:
        print(ans[1])
    else:
        print(ans[0])

Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())

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

center = N // 2 - 1

for i in range(N):
    B = copy.deepcopy(X)

    del B[i]

    B.sort(reverse=True)

    print(B[center])

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
center = N // 2
X_ = sorted(X)
ans = [X_[center-1], X_[center]]
center = sum(ans) / 2

for x in X:
    if x < center:
        print(ans[1])
    else:
        print(ans[0])
Buggy python submission (verdict: Runtime Error):
from collections import deque

A, B, K = input().split()

A = int(A)
B = int(B)
K = int(K)

value = deque()
s = [i for i in range(A, B+1)]

value.extend(s[0:K])
value.extend(s[len(s)-K:len(s)])

num = list(set(value))

for i in range(len(num)):
    print(num[i])

Fixed submission:
S = input().split()

if 'a' in S[0] and 'b' in S[0] and 'c' in S[0]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N_K = list(map(int, input().split()))
 
count = 0

a = np.array([i for i in range(1, N_K[0]+1)])
b = np.array([i for i in range(1, N_K[0]+1)])

for i in range(len(b)):
    count += sum(a % b[i] >= N_K[1])

    
'''
for a in range(1, N_K[0]+1):
  for b in range(1, N_K[0]+1):
    if a % b >= N_K[1]:
      count += 1
'''

print(count)

Fixed submission:
N, K = list(map(int, input().split()))
ans = 0

for b in range(1, N+1):
	p = N // b
	r = N % b
	
	ans += p * max(0, b-K)
	ans += max(0, r-K+1)
	
print(ans-N*(not K))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N_K = list(map(int, input().split()))
 
count = 0

a = np.array([i for i in range(1, N_K[0]+1)])
b = np.array([i for i in range(1, N_K[0]+1)])

for i in range(len(b)):
    value = a % b[i]

    for l in range(len(value)):
        if value[l] >= N_K[1]:
            count += 1

'''
for a in range(1, N_K[0]+1):
  for b in range(1, N_K[0]+1):
    if a % b >= N_K[1]:
      count += 1
'''
print(count)

Fixed submission:
N, K = list(map(int, input().split()))
ans = 0

for b in range(1, N+1):
	p = N // b
	r = N % b
	
	ans += p * max(0, b-K)
	ans += max(0, r-K+1)
	
print(ans-N*(not K))

Buggy python submission (verdict: Time Limit Exceeded):
N_K = list(map(int, input().split()))
 
count = 0
 
for a in range(1, N_K[0]+1):
  for b in range(1, N_K[0]+1):
    if a % b >= N_K[1]:
      count += 1
    
print(count)


Fixed submission:
N, K = list(map(int, input().split()))
ans = 0

for b in range(1, N+1):
	p = N // b
	r = N % b
	
	ans += p * max(0, b-K)
	ans += max(0, r-K+1)
	
print(ans-N*(not K))

Buggy python submission (verdict: Runtime Error):
N_K = list(map(int, input().split()))

count = 0

for a in range(1, N_K+1[0]):
  for b in range(1, N_K+1[0]):
    if a % b >= N_K[1]:
      count += 1
    
print(count)

Fixed submission:
N, K = list(map(int, input().split()))
ans = 0

for b in range(1, N+1):
	p = N // b
	r = N % b
	
	ans += p * max(0, b-K)
	ans += max(0, r-K+1)
	
print(ans-N*(not K))
Buggy python submission (verdict: Runtime Error):
H, W, D = map(int, input().split())

a = [0] * (H*W+1)

for i in range(H):
    A = list(map(int, input().split()))
    for j, _ in enumerate(A):
        a[_] = (i+1, j+1)

table = [0] * (H*W)
for i in range(D+1, H*W):
    x, y = a[i]
    x_, y_ = a[i-D]
    table[i] = table[i-D] + abs(x - x_) + abs(y - y_)

for i in range(int(input())):
    L, R = map(int, input().split())
    print(table[R] - table[L])


Fixed submission:
H, W, D = map(int, input().split())
px = [0] * (H*W+1)
py = [0] * (H*W+1)
d = [0] * (H*W+1)

for i in range(H):
    A = list(map(int, input().split()))
    for j, a in enumerate(A):
        px[a] = i
        py[a] = j

for i in range(D+1, H*W+1):
    d[i] = d[i-D] + abs(px[i]-px[i-D]) + abs(py[i]-py[i-D])

for i in range(int(input())):
    L, R = map(int, input().split())
    print(d[R]-d[L])

Buggy python submission (verdict: Runtime Error):
H, W, D = map(int, input().split())

a = [None] * (H*W+1)

for i in range(H):
    A = list(map(int, input().split()))
    for j, _ in enumerate(A):
        a[_] = (i+1, j+1)

table = [0] * (H*W)
for i in range(D+1, H*W):
    x, y = a[i]
    x_, y_ = a[i-D]
    table[i] = table[i-D] + abs(x - x_) + abs(y - y_)

for i in range(int(input())):
    L, R = map(int, input().split())
    print(table[R] - table[L])

Fixed submission:
H, W, D = map(int, input().split())
px = [0] * (H*W+1)
py = [0] * (H*W+1)
d = [0] * (H*W+1)

for i in range(H):
    A = list(map(int, input().split()))
    for j, a in enumerate(A):
        px[a] = i
        py[a] = j

for i in range(D+1, H*W+1):
    d[i] = d[i-D] + abs(px[i]-px[i-D]) + abs(py[i]-py[i-D])

for i in range(int(input())):
    L, R = map(int, input().split())
    print(d[R]-d[L])
Buggy python submission (verdict: Runtime Error):
import queue

H, W = list(map(int, input().split()))
s = [list(input()) + ['#'] for i in range(H)] + [['#' for i in range(W+1)]]
white = sum([s[i].count('.') for i in range(H)])

q = queue.PriorityQueue()
s[0][0] = 1
q.put((0,0))

while not q.empty():
    i, j = q.get()
    for x, y in [(i+1,j), (i-1,j), (i,j+1), (i,j-1)]:
        if s[x][y] == '.':
            s[x][y] = s[i][j]+1
            q.put((x, y))

print(white-s[H-1][W-1])

Fixed submission:
import queue

H, W = list(map(int, input().split()))
s = [list(input()) + ['#'] for i in range(H)] + [['#' for i in range(W+1)]]
white = sum([s[i].count('.') for i in range(H)])

q = queue.Queue()
s[0][0] = 1
q.put((0,0))

while not q.empty():
    i, j = q.get()
    for x, y in [(i+1,j), (i-1,j), (i,j+1), (i,j-1)]:
        if s[x][y] == '.':
            s[x][y] = s[i][j]+1
            q.put((x, y))

if s[H-1][W-1] in ['.', '#']:
    print(-1)
else:
    print(white-s[H-1][W-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())

A = []
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

if N > 1:
    up = A[0][1]
    down = A[1][0]

    for i in range(1, N-1):
        up_ = up + A[1][i]
        down += A[1][i]
        up += A[0][i+1]

        down = max(down, up_)

    print(max(up, down)+A[0][0]+A[1][N-1])
else:
    print(sum(A))


Fixed submission:
N = int(input())

A = []
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

if N > 1:
    up = A[0][1]
    down = A[1][0]

    for i in range(1, N-1):
        up_ = up + A[1][i]
        down += A[1][i]
        up += A[0][i+1]

        down = max(down, up_)

    print(max(up, down)+A[0][0]+A[1][N-1])
else:
    print(A[0][0]+A[1][0])

Buggy python submission (verdict: Runtime Error):
from collections import deque

N = int(input())
A = deque()
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

value_A = A[0][0] + A[0][1]
value_B = A[0][0] + A[1][0]

for i in range(2, N):
    value_C = value_A + A[1][i-1]
    value_A += A[0][i]
    value_B += A[1][i-1]

    if value_B < value_C:
        value_B = value_C

print(str(max(value_A, value_B, value_C) + A[1][N-1]))

Fixed submission:
N = int(input())

A = []
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

if N > 1:
    up = A[0][1]
    down = A[1][0]

    for i in range(1, N-1):
        up_ = up + A[1][i]
        down += A[1][i]
        up += A[0][i+1]

        down = max(down, up_)

    print(max(up, down)+A[0][0]+A[1][N-1])
else:
    print(A[0][0]+A[1][0])

Buggy python submission (verdict: Runtime Error):
from collections import deque

N = int(input())
A = deque()
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

if N == 1:
    print(str(A[0][0] + A[1][0]))
else:
    value_A = A[0][0] + A[0][1]
    value_B = A[0][0] + A[1][0]

    for i in range(2, N):
        value_C = value_A + A[1][i-1]
        value_A += A[0][i]
        value_B += A[1][i-1]

        if value_B < value_C:
            value_B = value_C

    print(str(max(value_A, value_B, value_C) + A[1][N-1]))

Fixed submission:
N = int(input())

A = []
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

if N > 1:
    up = A[0][1]
    down = A[1][0]

    for i in range(1, N-1):
        up_ = up + A[1][i]
        down += A[1][i]
        up += A[0][i+1]

        down = max(down, up_)

    print(max(up, down)+A[0][0]+A[1][N-1])
else:
    print(A[0][0]+A[1][0])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
G = [[] for i in range(N+1)]
x = [0] * (N+1)
visited = [False] * (N+1)

for i in range(M):
    L, R, D = map(int, input().split())
    G[L].append((R, D))
    G[R].append((L, -D))

for i in range(1, N+1):
    if not visited[i]:
        q = G[i]
        visited[i] = True
        while q:
            u, d = q.pop(0)
            if not visited[u]:
                x[u] = d
                visited[u] = True
                for v, d_ in G[u]:
                    q.append((v, d+d_))
            
            else:
                if x[u] != d:
                    print('No')
                    exit()
print('Yes')

Fixed submission:
from collections import deque

N, M = map(int, input().split())
G = [deque() for i in range(N+1)]
x = [0] * (N+1)
visited = [True] * (N+1)

for i in range(M):
    L, R, D = map(int, input().split())
    G[L].append((R, D))
    G[R].append((L, -D))
    visited[L] = False
    visited[R] = False
    
for i in range(1, N+1):
    if not visited[i]:
        q = G[i]
        visited[i] = True
        
        while q:
            u, d = q.pop()
            
            for v, d_ in G[u]:
                if visited[v]:
                    if x[v] != d+d_:
                        print('No')
                        exit()
                else:
                    visited[v] = True
                    x[v] = d+d_
                    q.append((v, d+d_))
print('Yes')
Buggy python submission (verdict: Runtime Error):
N = int(input())

L0 = 2
L1 = 1

for i in range(N-1):
    L = L0 + L1
    L0 = L1
    L1 = L

print(L)

Fixed submission:
N = int(input())

L0 = 2
L1 = L = 1

for i in range(N-1):
    L = L0 + L1
    L0 = L1
    L1 = L

print(L)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if '9' in N:
  print('Yes')
else:
  print('No')

Fixed submission:
N = input()
if '9' in N:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N, M, R = map(int, input().split())
r = list(map(int, input().split()))
INF = 10**10
dp = [[INF for i in range(N+1)] for j in range(N+1)]

for i in range(M):
    A, B, C = map(int, input().split())
    dp[A][B] = C
    dp[B][A] = C

for k in range(1, N+1):
    for i in range(1, N+1):
        for j in range(1, N+1):
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

ans = 10**10
for route in itertools.permutations(r):
    total = 0
    for i in range(R-1):
        total += dp[route[i]][route[i+1]]
    ans = min(ans, total)
print(ans)


Fixed submission:
import heapq
import itertools

def dijkstra(s):
    cost = [10**20] * (N+1)
    visited = [False] * (N+1)
    visited[s], cost[s] = True, 0
    q = []

    for r in route[s]:
        heapq.heappush(q, r)

    while q:
        c, r = heapq.heappop(q)

        if not visited[r]:
            visited[r] = True
            cost[r] = min(cost[r], c)

            for c_, n in route[r]:
                if not visited[n]:
                    heapq.heappush(q, (c+c_, n))

    return cost

N, M, R = map(int, input().split())
r_ = list(map(int, input().split()))
ans = 10**10
route = [[] for i in range(N+1)]

for i in range(M):
    A, B, C = map(int, input().split())
    route[A].append((C, B))
    route[B].append((C, A))

cost = {r:dijkstra(r) for r in r_}
for r in itertools.permutations(r_):
    total = 0

    for i in range(R-1):
        total += cost[r[i]][r[i+1]]
    ans = min(ans, total)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

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

for i in range(1, N):
    T[i] = int(T[i] * T[i-1] / math.gcd(T[i], T[i-1]))
print(T[-1])

Fixed submission:
import fractions as math

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

for i in range(1, N):
    T[i] = T[i] * T[i-1] // math.gcd(T[i], T[i-1])
print(T[-1])