Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# key not available ""
n = int(input())
matrix = []
for _ in range(n):
    matrix.append([int(i) for i in input().split()])
dp = [[0 for i in range(10)] for j in range(n+1)]


def go(i, j):
    if i < 0:
        return 0
    ans = 0
    if dp[i][j] > 0:
        return dp[i][j]
    dp[i][j] = max(ans, go(i-1, (j+1) % 3)+matrix[i][j], go(i-1, (j+2) % 3)+matrix[i][j])
    return dp[i][j]


print(max(go(n-1, 2),go(n-1,1),go(n-1,0)))



Fixed submission:
# key not available ""
n = int(input())
matrix = []
for _ in range(n):
    matrix.append([int(i) for i in input().split()])
dp = [[0 for i in range(3)] for j in range(n)]
for i in range(3):
    dp[0][i] = matrix[0][i]
for i in range(1,n):
    for j in range(3):
        if j == 0:
            dp[i][j] = max(dp[i-1][j+1],dp[i-1][j+2])+matrix[i][j]
        elif j == 1:
            dp[i][j] = max(dp[i-1][j+1],dp[i-1][j-1])+matrix[i][j]
        else:
            dp[i][j] = max(dp[i-1][j-1], dp[i-1][j-2]) + matrix[i][j]
print(max(dp[-1]))

Buggy python submission (verdict: Runtime Error):
# key not available ""
n = int(input())
matrix = []
for _ in range(n):
    matrix.append([int(i) for i in input().split()])
dp = [[0 for i in range(3)] for j in range(n+1)]


def go(i, j):
    if i < 0:
        return 0
    ans = 0
    if dp[i][j] > 0:
        return dp[i][j]
    dp[i][j] = max(ans, go(i-1, (j+1) % 3)+matrix[i][j], go(i-1, (j+2) % 3)+matrix[i][j])
    return dp[i][j]


print(max(go(n-1, 2),go(n-1,1),go(n-1,0)))



Fixed submission:
# key not available ""
n = int(input())
matrix = []
for _ in range(n):
    matrix.append([int(i) for i in input().split()])
dp = [[0 for i in range(3)] for j in range(n)]
for i in range(3):
    dp[0][i] = matrix[0][i]
for i in range(1,n):
    for j in range(3):
        if j == 0:
            dp[i][j] = max(dp[i-1][j+1],dp[i-1][j+2])+matrix[i][j]
        elif j == 1:
            dp[i][j] = max(dp[i-1][j+1],dp[i-1][j-1])+matrix[i][j]
        else:
            dp[i][j] = max(dp[i-1][j-1], dp[i-1][j-2]) + matrix[i][j]
print(max(dp[-1]))
Buggy python submission (verdict: Time Limit Exceeded):
# key not available ""
n, w = [int(i) for i in input().split()]
weights = []
value = []
for _ in range(n):
    x, y = [int(i) for i in input().split()]
    weights.append(x)
    value.append(y)
dp = [[-1 for i in range(w+1)] for j in range(n)]
def go(i,w):
    if w <= 0 or i < 0:
        return 0
    if dp[i][w] >= 0:
        return dp[i][w]
    if weights[i] <= w:
        dp[i][w] = max(go(i-1, w), go(i-1, w-weights[i])+value[i])
    else:
        dp[i][w] = go(i-1,w)
    return dp[i][w]
print(go(n-1,w))
## 0 1 2 3  4  5  6  7  8
#  0 0 0 30 30 30 30 30 30
#  0 0 0 30 50 50 50 80 80
#  0 0 0 30 50 60 60 80 90

Fixed submission:
# key not available ""
n, w = [int(i) for i in input().split()]
weights = []
value = []
for _ in range(n):
    x, y = [int(i) for i in input().split()]
    weights.append(x)
    value.append(y)
dp = [[0 for i in range(w+1)] for j in range(n)]
for i in range(n):
    for j in range(1, w+1):
        if weights[i] <= j:
            dp[i][j] = max(value[i] + dp[i-1][j-weights[i]],dp[i-1][j])
        else:
            dp[i][j] = max(dp[i][j-1],dp[i-1][j])
print(dp[-1][-1])

## 0 1 2 3  4  5  6  7  8
#  0 0 0 30 30 30 30 30 30
#  0 0 0 30 50 50 50 80 80
#  0 0 0 30 50 60 60 80 90

Buggy python submission (verdict: Time Limit Exceeded):
# key not available ""
n, w = [int(i) for i in input().split()]
weights = []
value = []
for _ in range(n):
    x, y = [int(i) for i in input().split()]
    weights.append(x)
    value.append(y)
dp = [[0 for i in range(w+1)] for j in range(n)]
def go(i,w):
    if w <= 0 or i < 0:
        return 0
    if dp[i][w] >0:
        return dp[i][w]
    if weights[i] <= w:
        dp[i][w] = max(go(i-1, w), go(i-1, w-weights[i])+value[i])
    else:
        dp[i][w] = go(i-1,w)
    return dp[i][w]
print(go(n-1,w))
## 0 1 2 3  4  5  6  7  8
#  0 0 0 30 30 30 30 30 30
#  0 0 0 30 50 50 50 80 80
#  0 0 0 30 50 60 60 80 90

Fixed submission:
# key not available ""
n, w = [int(i) for i in input().split()]
weights = []
value = []
for _ in range(n):
    x, y = [int(i) for i in input().split()]
    weights.append(x)
    value.append(y)
dp = [[0 for i in range(w+1)] for j in range(n)]
for i in range(n):
    for j in range(1, w+1):
        if weights[i] <= j:
            dp[i][j] = max(value[i] + dp[i-1][j-weights[i]],dp[i-1][j])
        else:
            dp[i][j] = max(dp[i][j-1],dp[i-1][j])
print(dp[-1][-1])

## 0 1 2 3  4  5  6  7  8
#  0 0 0 30 30 30 30 30 30
#  0 0 0 30 50 50 50 80 80
#  0 0 0 30 50 60 60 80 90
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
sum = 1

for i in A:
    sum *= i

if sum > 10**18:
    print(-1)
else:
    print(sum)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
flag = False
sum = 1

for i in A:
    if not flag:
        if sum*i > 10**18:
            flag = True
        else:
            sum *= i
    else:
        if i == 0:
            print(0)
            exit()
if flag:
    print(-1)
else:
    print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
from decimal import *
A,B = map(str,input().split())
A = int(A)
B = float(B)
ans = 0

for i in range(1,A+1):
    ans += B

print(int(ans))

Fixed submission:
A,B = map(str,input().split())
A = int(A)
B = int(float(B)*1000)
ans = A*B

print(int(A*B)//1000)
Buggy python submission (verdict: Runtime Error):
import itertools
n,m,q = map(int,input().split())
array = []
A = [i for i in range(1,m+1)]
A_list = list(itertools.combinations(A,n))
max_sum = [0]*len(A_list)

for i in range(q):
    a,b,c,d = map(int,input().split())
    for j in range(len(A_list)):
        if A_list[j][b-1]-A_list[j][a-1] == c:
            max_sum[j] += d
print(max(max_sum))

Fixed submission:
import itertools
n,m,q = map(int,input().split())
array = []
A = [i for i in range(1,m+1)]
A_list = list(itertools.combinations_with_replacement(A,n))
max_sum = [0]*len(A_list)

for i in range(q):
    a,b,c,d = map(int,input().split())
    for j in range(len(A_list)):
        if A_list[j][b-1]-A_list[j][a-1] == c:
            max_sum[j] += d
print(max(max_sum))

Buggy python submission (verdict: Runtime Error):
import itertools
n,m,q = map(int,input().split())
array = []
A = [i for i in range(1,m+1)]
A_list = list(itertools.combinations(A,n))
max_sum = [0]*len(A_list)

for i in range(q):
    a,b,c,d = map(int,input().split())
    for j in range(len(A_list)):
        if A_list[j][b-1]-A_list[j][a-1] == c:
            max_sum[j] += d
print(max(max_sum))


Fixed submission:
import itertools
n,m,q = map(int,input().split())
array = []
A = [i for i in range(1,m+1)]
A_list = list(itertools.combinations_with_replacement(A,n))
max_sum = [0]*len(A_list)

for i in range(q):
    a,b,c,d = map(int,input().split())
    for j in range(len(A_list)):
        if A_list[j][b-1]-A_list[j][a-1] == c:
            max_sum[j] += d
print(max(max_sum))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())

judge = 0

if n%k==0:
    judge = 1
    print(0)
if judge == 0:
    while n>= 0:
        n -= k

    if abs(n+k)<abs(n):
        print(abs(n+k))
    else:
        print(abs(n))

Fixed submission:
n,k = map(int,input().split())

n = n%k

if n<abs(n-k):
    print(n)
else:
    print(abs(n-k))
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split()))

m = L.pop(max(L))
if sum(L) > m:
    print('Yes')
else:
    print('No')

Fixed submission:
N = int(input())
L = list(map(int,input().split()))

m = L.pop(L.index(max(L)))
if sum(L) > m:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import fractions from gcd
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
m = x[1]-x[0]

for i in range(1,N+1):
    n = x[i]-x[i-1]
    v = gcd(m,n)
    m = v

print(m)






Fixed submission:
from fractions import gcd
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
m = x[1]-x[0]

for i in range(1,N+1):
    n = x[i]-x[i-1]
    v = gcd(m,n)
    m = v

print(m)

Buggy python submission (verdict: Runtime Error):
import fractions import gcd
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
m = x[1]-x[0]

for i in range(1,N+1):
    n = x[i]-x[i-1]
    v = gcd(m,n)
    m = v

print(m)






Fixed submission:
from fractions import gcd
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
m = x[1]-x[0]

for i in range(1,N+1):
    n = x[i]-x[i-1]
    v = gcd(m,n)
    m = v

print(m)
Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
S = list(input())
cnt = 0
cntW = 0
cntE = 0
n = N-1

index = 0
for i in range(N-1):
    if S[i] != S[i+1]:
        cnt += 1
        index = i
i = 0
if cnt == 1:
    m = min(index,n-index)
    print(m)
    exit()
else:
    while i != n-1:
        if S[n] == 'E':
            cntE += 1
        if S[i] == 'W':
            i += 1
            n -= 1
            cntW += 1
        else:
            i += 1
print(cntW+cntE)
    


Fixed submission:
import collections
N = int(input())
S = list(input())
cnt = 0

ans = [0]*N

for i in range(1,N):
    if S[i] == "E":
        cnt += 1
ans[0] = cnt

for i in range(1,N):
    if S[i-1] == 'E' and S[i] == 'E':
        ans[i] = ans[i-1]-1
    elif S[i-1] == "W" and S[i] == 'W':
        ans[i] = ans[i-1]+1
    else:
        ans[i] = ans[i-1]
     
print(min(ans))

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
S = list(input())
cnt = 0
cntW = 0
cntE = 0
n = N-1
i = 0

index = 0
for i in range(N):
    if S[i] == 'W' and S[i+1] == 'E':
        cnt += 1
        index = i
if cnt == 1:
    m = min(index,n-index)
    print(m)
    exit()
else:
    while i != n-1:
        if S[n] == 'E':
            cntE += 1
        if S[i] == 'W':
            i += 1
            n -= 1
            cntW += 1
        else:
            i += 1
print(cntW+cntE)
    


Fixed submission:
import collections
N = int(input())
S = list(input())
cnt = 0

ans = [0]*N

for i in range(1,N):
    if S[i] == "E":
        cnt += 1
ans[0] = cnt

for i in range(1,N):
    if S[i-1] == 'E' and S[i] == 'E':
        ans[i] = ans[i-1]-1
    elif S[i-1] == "W" and S[i] == 'W':
        ans[i] = ans[i-1]+1
    else:
        ans[i] = ans[i-1]
     
print(min(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = list(input())
cnt = []

for i in range(0,N-1):
    e = S[0:i].count('W')
    w = S[i+1:].count('E')
    cnt.append(e+w)
print(min(cnt))
    

Fixed submission:
import collections
N = int(input())
S = list(input())
cnt = 0

ans = [0]*N

for i in range(1,N):
    if S[i] == "E":
        cnt += 1
ans[0] = cnt

for i in range(1,N):
    if S[i-1] == 'E' and S[i] == 'E':
        ans[i] = ans[i-1]-1
    elif S[i-1] == "W" and S[i] == 'W':
        ans[i] = ans[i-1]+1
    else:
        ans[i] = ans[i-1]
     
print(min(ans))
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
K = int(input())
array = []
for i in range(3):
    array[i] = [A,B,C]

for i in range(3):
    array[i][i] *= 2**K

print(max(sum(array[0],array[1],array[2])))
    



Fixed submission:
A,B,C = map(int,input().split())
K = int(input())
array = []
for i in range(3):
    array.append([A,B,C])

for i in range(3):
    array[i][i] *= 2**K

print(max(sum(array[0]),sum(array[1]),sum(array[2])))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
n = N//2
for i in range(N):
    array = A[0:i]+A[i+1:]
    array.sort()
    print(array[n-1])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A_copy = A.copy()
n = N//2
A.sort()
avg = (A[n]+A[n-1])/2
for i in A_copy:
    if i < avg:
        print(A[n])
    else:
        print(A[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
A.append(0)
ans = []
n = len(A)
for i in range(1,len(A)-1):
    sum = 0
    for j in range(len(A)):
        if i != j:
            if i == j-1:
                sum += abs(A[j]-A[j-2])
            else:
                sum += abs(A[j]-A[j-1])
    ans.append(sum)
for i in ans:
    print(i)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
A.append(0)
ans = []
n = len(A)
S = 0
for i in range(1,n):
    S += abs(A[i]-A[i-1])

for i in range(1,n-1):
    sum = S + abs(A[i+1]-A[i-1])-abs(A[i-1]-A[i])-abs(A[i]-A[i+1])
    ans.append(sum)

for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
c = [list(map(str,input().split())) for i in range(3)]

print(''.join([c[0][0],c[1][1],c[2][2]]))

Fixed submission:
c = [list(input()) for i in range(3)]
print(''.join([c[0][0],c[1][1],c[2][2]]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(map(int,input().split()))
if len(set(S)) == 4:
    print('Four')
elif len(set(S)) == 3:
    print('Three')

Fixed submission:
N = int(input())
S = list(map(str,input().split()))
if len(set(S)) == 4:
    print('Four')
elif len(set(S)) == 3:
    print('Three')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if A*B%2==0:
    print('Even')
else:
    print('Odd')

Fixed submission:
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
a = list(map(int,input().split()))
a.sort()
array = list(set(a))
sum = 0
for i in range(len(array)):
    if a.count(array[i]) >= array[i]:
        sum += a.count(array[i]) - array[i]
    else:
        sum += a.count(array[i])
print(sum)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
A = a.sort()
array = list(set(a))
array.sort()
sum = 0
n = 0
for i in range(len(array)):
    cnt = 0
    for j in range(n,len(a)):
        if array[i] == a[j]:
            cnt += 1
        else:
            break
    n += cnt
    if cnt >= array[i]:
        sum += cnt - array[i]
    else:
        sum += cnt
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
a = list(map(int,input().split()))
a.sort()
array = []
sum = 0
for i in range(len(a)):
    if a[i] not in array:
        array.append(a[i])

for i in range(len(array)):
    if a.count(array[i]) >= array[i]:
        sum += a.count(array[i]) - array[i]
    else:
        sum += a.count(array[i])
print(sum)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
A = a.sort()
array = list(set(a))
array.sort()
sum = 0
n = 0
for i in range(len(array)):
    cnt = 0
    for j in range(n,len(a)):
        if array[i] == a[j]:
            cnt += 1
        else:
            break
    n += cnt
    if cnt >= array[i]:
        sum += cnt - array[i]
    else:
        sum += cnt
print(sum)
Buggy python submission (verdict: Runtime Error):
N = input()
n = int(N)
sum = 0
a = list(input())
for i in range(len(a)):
    sum += int(a[i])

if n%sum==0:
    print('Yes')
else:
    print('No')

Fixed submission:
N = input()
n = int(N)
sum = 0
a = list(N)
for i in range(len(a)):
    sum += int(a[i])

if n%sum==0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = list(int(input()))
cnt = 0
ans = []
for i in range(len(N)-1):
    if N[i] == N[i+1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
for i in ans:
    if i >= 3:
        print('Yes')
        exit()
print('No')  

Fixed submission:
import collections
N = list(input())
cnt = 0
ans = []
for i in range(len(N)-1):
    if N[i] == N[i+1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
ans.append(cnt)
for i in ans:
    if i >= 2:
        print('Yes')
        exit()
print('No')
Buggy python submission (verdict: Runtime Error):
X,Y = map(int,input().split())

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

Fixed submission:
X,Y = map(str,input().split())

a = ['A','B','C','D','E','F']
b = [10,11,12,13,14,15]

if a.index(X) > a.index(Y):
    print('>')
elif X == Y:
    print('=')
else:
    print('<')
Buggy python submission (verdict: Runtime Error):
N = int(input())

for i in range(N):
    if i**2 > N:
        print(i-1)**2
        exit()

Fixed submission:
n = int(input())

ans = 0

for a in range(10**5 + 1):
    if a**2 <= n:
        ans = max(ans, a**2)

print(ans)
Buggy python submission (verdict: Runtime Error):
N = list(input())

if N in '9':
    print('Yes')
else:
    print('No')

Fixed submission:
N = list(input())

if '9' in N:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range(N):
    if p[i] == i+1:
        value = p[i]
        p[i] = p[i+1]
        p[i+1] = value
        cnt += 1
print(cnt)
    

Fixed submission:
N = int(input())
p = list(map(int,input().split()))
cnt = 0
flag = True
for i in range(N):
    if p[i] == i+1:
        if flag:
            cnt += 1
            flag = False
        else:
            flag = True
    else:
        flag = True
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
A = list(map(int,input().split()))
max = 0
comb = list(itertools.combinations(A,4))
for i in range(len(comb)):
    item = list(set(comb[i]))
    if len(item) == 2:
        if max < item[0]*item[1]:
            max = item[0]*item[1]

print(max)





Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int,input().split()))
c = Counter(A)
sticks = []
for i in c:
    s = c[i]
    if s >= 4:
        sticks.append(i)
    if s >= 2:
        sticks.append(i)
if len(sticks) < 2:
    print(0)
else:
    sticks.sort(reverse=True)
    print(sticks[0]*sticks[1])

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
A = list(map(int,input().split()))
a = set(A)
max = 0
comb = list(itertools.combinations(A,4))
for i in range(len(comb)):
    item = list(set(comb[i]))
    if len(item) == 2:
        if max < item[0]*item[1]:
            max = item[0]*item[1]

print(max)





Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int,input().split()))
c = Counter(A)
sticks = []
for i in c:
    s = c[i]
    if s >= 4:
        sticks.append(i)
    if s >= 2:
        sticks.append(i)
if len(sticks) < 2:
    print(0)
else:
    sticks.sort(reverse=True)
    print(sticks[0]*sticks[1])
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())

s = min(B-C,D-C)

if s <= 0:
    s = 0

print(s

Fixed submission:
A,B,C,D = map(int,input().split())

s = min(B,D)-max(A,C)

if s <= 0:
    s = 0

print(s)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
t_lcm = int(input())
for i in range(N-1):
  t = int(input())
  t_lcm = (t_lcm*t)//fractions.gcd(t,t_lcm)
print(t_lcm)



Fixed submission:
import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
t_lcm = int(input())
for i in range(N-1):
  t = int(input())
  t_lcm = (t_lcm*t)//math.gcd(t,t_lcm)
print(t_lcm)



Fixed submission:
import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

N = int(input())
T = np.array([int(input()) for _ in range(N)])

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

t_lcm = lcm(T[0],T[1])
for i in range(2,N):
    t_lcm = lcm(t_lcm,T[i])
print(t_lcm)



Fixed submission:
import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
T = np.array([int(input()) for _ in range(N)])


print(np.lcm.reduce(T))
# for i in range(1,N):



Fixed submission:
import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
T = []

for i in range(N):
    t = int(input())
    T.append(t)

a = np.array(T)
print(np.lcm.reduce(a))


Fixed submission:
import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
import numpy as np



N = int(input())
T = []

for i in range(N):
    t = int(input())
    T.append(t)

print(np.lcm.reduce(T))


Fixed submission:
import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
T = []

for i in range(N):
    t = int(input())
    T.append(t)

print(np.lcm.reduce(T))


Fixed submission:
import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
T = []

for i in range(N):
    t = int(input())
    T.append(t)

print(np.lcm.reduce(T))


Fixed submission:
import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

s = []
g = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        s.append(g)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')



Fixed submission:
N,M = map(int,input().split())

s = []
g = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        s.append(b)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
ab= [list(map(int,input().split())) for i in range(M)]

n = len(ab)

for i in range(n):
    if ab[i][1] != N:
        continue
    for j in range(n):
       if ab[i][0] == ab[j][1] and ab[j][0] == 1:
           print('POSSIBLE')
           exit()
print('IMPOSSIBLE')

Fixed submission:
N,M = map(int,input().split())

s = []
g = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        s.append(b)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N,M = map(int,input().split())
ab= [list(map(int,input().split())) for i in range(M)]

d = deque()

for i in range(len(ab)):
    if ab[i][1] == N:
        d.append(ab[i][0])

for i in range(len(d)):
    for j in range(len(ab)):
        if ab[j][0] == 1 and ab[j][1] == d[i]:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')

Fixed submission:
N,M = map(int,input().split())

s = []
g = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        s.append(b)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
ab= [list(map(int,input().split())) for i in range(M)]

x = []

for i in range(len(ab)):
    if ab[i][1] == N:
        x.append(ab[i][0])

for i in range(len(x)):
    for j in range(len(ab)):
        if ab[j][0] == 1 and ab[j][1] == x[i]:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')

Fixed submission:
N,M = map(int,input().split())

s = []
g = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        s.append(b)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')