Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def triangles(a): 
    n = len(a) 
    a.sort() 
    count = 0
    for i in range(0,n-2):
        for j in range(i+1,n): 
            k=j+1
            while (k < n and a[i] + a[j] > a[k]): 
                k += 1
            if(k>j): 
                count += k - j - 1
    return count
n=int(input())
a=list(map(int,input().split()))
print(triangles(a))


Fixed submission:
def triangles(a): 
    n = len(a) 
    a.sort() 
    count = 0
    for i in range(0,n-2):
        k=i+2
        for j in range(i+1,n): 
            while (k < n and a[i] + a[j] > a[k]): 
                k += 1
            if(k>j): 
                count += k - j - 1
    return count
n=int(input())
a=list(map(int,input().split()))
print(triangles(a))

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int, input().split()))
l=sorted([x for x in set(l) if l.count(x)<4])
ans=0
x=[]
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,(n-sum((x>l[j]+l[i]) for x in l))):
            if (l[i]<(l[j]+l[k])and l[j]<(l[i]+l[k]) and x.count([l[i],l[j],l[k]])==0):
                x.append([l[i],l[j],l[k]])
                ans+=1

print(ans)


Fixed submission:
def triangles(a): 
    n = len(a) 
    a.sort() 
    count = 0
    for i in range(0,n-2):
        k=i+2
        for j in range(i+1,n): 
            while (k < n and a[i] + a[j] > a[k]): 
                k += 1
            if(k>j): 
                count += k - j - 1
    return count
n=int(input())
a=list(map(int,input().split()))
print(triangles(a))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=sorted(list(map(int, input().split())))
ans=0
x=[]
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,(n-sum((x>l[j]+l[i]) for x in l))):
            if (l[i]<(l[j]+l[k])and l[j]<(l[i]+l[k]) and l[k]<(l[j]+l[i]) and x.count([l[i],l[j],l[k]])==0):
                x.append([l[i],l[j],l[k]])
                ans+=1

print(ans)

Fixed submission:
def triangles(a): 
    n = len(a) 
    a.sort() 
    count = 0
    for i in range(0,n-2):
        k=i+2
        for j in range(i+1,n): 
            while (k < n and a[i] + a[j] > a[k]): 
                k += 1
            if(k>j): 
                count += k - j - 1
    return count
n=int(input())
a=list(map(int,input().split()))
print(triangles(a))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=sorted(list(map(int, input().split())))
ans=0
x=[]
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if (l[i]<(l[j]+l[k])and l[j]<(l[i]+l[k]) and l[k]<(l[j]+l[i]) and x.count([l[i],l[j],l[k]])==0):
                x.append([l[i],l[j],l[k]])
                ans+=1


print(ans)

Fixed submission:
def triangles(a): 
    n = len(a) 
    a.sort() 
    count = 0
    for i in range(0,n-2):
        k=i+2
        for j in range(i+1,n): 
            while (k < n and a[i] + a[j] > a[k]): 
                k += 1
            if(k>j): 
                count += k - j - 1
    return count
n=int(input())
a=list(map(int,input().split()))
print(triangles(a))
Buggy python submission (verdict: Runtime Error):
l,r = map(int,input().split())
ans=2019
for i in range(l,r+1):
    for j in range(i+1,r+1):
        ans=min((i*j)%2019,ans)
        
        
print(ans)

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



print(min([b,n*a]))
Buggy python submission (verdict: Time Limit Exceeded):
l,r = map(int,input().split())
ans=2019
for i in range(l,r+1):
    for j in range(i+1,r+1):
        ans=min((i*j)%2019,ans)
        
        
print(ans)

Fixed submission:
l,r = map(int,input().split())
ans=2019

for i in range(l,r+1):  
    if r-l>=2019:
        ans=0
        break
    for j in range(i+1,r+1):
        ans=min((i*j)%2019,ans)
                
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc129/tasks/abc129_c

def dp1(n,a):
    dp=[0]*(n+1)
    dp[0]=1
    if 1 not in a:
        dp[1]=1
    if n==1:
        return dp[1]
    else:
        for i in range(2,n+1):
            if i not in a:
                dp[i]=dp[i-1]+dp[i-2]    
    return dp[n]

def main():
    n, m= map(int, input().split())
    a = [int(input()) for _ in range(m)]    
    print(dp1(n,a)%1000000007)

main()

Fixed submission:
def dp1(n,a):
    dp=[0]*(n+1)
    dp[0]=1
    ok=[True]*(n+1)
    for x in a:
        ok[x]=False
    if 1 not in a:
        dp[1]=1
    if n==1:
        return dp[1]
    else:
        for i in range(2,n+1):
            if ok[i]:
                dp[i]=(dp[i-1]+dp[i-2])%1000000007 
    return dp[n]

def main():
    n, m= map(int, input().split())
    a = [int(input()) for _ in range(m)]    
    print(dp1(n,a))

main()
Buggy python submission (verdict: Runtime Error):
s=int(input())
num=[]
while s > 0:
    num.append(s % 100)
    s //= 100

num.reverse()

if num[0]<=12 and num[0]>0:
    if num[1]<=12 and num[1]>0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if num[1]<=12 and num[1]>0:
        print("YYMM")
    else:
        print("NA")

Fixed submission:
s=int(input())
num=[]
while s > 0:
    num.append(s % 100)
    s //= 100

if len(num)==0:
    num.append(0)
if len(num)==1:
    num.append(0)
num.reverse()

if num[0]<=12 and num[0]>0:
    if num[1]<=12 and num[1]>0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if num[1]<=12 and num[1]>0:
        print("YYMM")
    else:
        print("NA")
Buggy python submission (verdict: Time Limit Exceeded):
# coding:utf-8
import math
import fractions

N,K=map(int, input().split())

if K==0:
    print("N")
elif N==0 or N%K==0:
    print("0")
else:
    a=fractions.gcd(N,K)
    N=N%K
    N=int(N/a)
    K=int(K/a)
    mi=N
    t=N
    for i in range(N):
        t=abs(t-K)
        mi=min(mi,t)
    print(mi*a)

Fixed submission:
# coding:utf-8
import math
import fractions

N,K=map(int, input().split())

if K==0:
    print("N")
elif N==0 or N%K==0:
    print("0")
else:
    N=N%K
    print(min(N, K-N))

Buggy python submission (verdict: Time Limit Exceeded):
# coding:utf-8
import math
import fractions

N,K=map(int, input().split())

if K==0:
    print("N")
elif N==0 or N%K==0:
    print("0")
else:
    mi=N
    t=N
    for i in range(math.ceil(N*1.0/fractions.gcd(N,K))):
        t=abs(t-K)
        mi=min(mi,t)
    print(mi)

Fixed submission:
# coding:utf-8
import math
import fractions

N,K=map(int, input().split())

if K==0:
    print("N")
elif N==0 or N%K==0:
    print("0")
else:
    N=N%K
    print(min(N, K-N))

Buggy python submission (verdict: Runtime Error):
# coding:utf-8
import math

N,K=map(int, input().split())

if K==0:
    print("N")
elif N==0 or N%K==0:
    print("0")
else:
    print(math.gcd(N,K))

Fixed submission:
# coding:utf-8
import math
import fractions

N,K=map(int, input().split())

if K==0:
    print("N")
elif N==0 or N%K==0:
    print("0")
else:
    N=N%K
    print(min(N, K-N))

Buggy python submission (verdict: Runtime Error):
# coding:utf-8
import math

N,K=map(int, input().split())

if N==0 or N%K==0:
    print("0")
else:
    print(math.gcd(N,K))

Fixed submission:
# coding:utf-8
import math
import fractions

N,K=map(int, input().split())

if K==0:
    print("N")
elif N==0 or N%K==0:
    print("0")
else:
    N=N%K
    print(min(N, K-N))
Buggy python submission (verdict: Time Limit Exceeded):
list1=input().split(' ')
N=int(list1[0])
K=int(list1[1])
Q=int(list1[2])
listQ=[]
for i in range(Q):
    listQ.append(int(input()))
listScores=[K for i in range(N)]
for i in listQ:
    listScores=[x-1 for x in listScores]
    listScores[i-1]=listScores[i-1]+1
for i in listScores:
    if i>0:
        print('Yes')
    elif i<=0:
        print('No')


Fixed submission:
list1=input().split(' ')
N=int(list1[0])
K=int(list1[1])
Q=int(list1[2])
listQ=[]
for i in range(Q):
    listQ.append(int(input()))
listScores=[K for i in range(N)]
sum=0
for i in listQ:
    sum=sum+1
    listScores[i-1]=listScores[i-1]+1
for i in listScores:
    i=i-sum
    if i>0:
        print('Yes')
    elif i<=0:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N,K=(input().split())
N,K=int(N),int(K)
seq=list(input().split())
seq=[int(x) for x in seq]
cou=0
C=0
inc=0
for i in range(len(seq)):
    for j in range(i+1,len(seq)):
        if seq[i]>seq[j]: cou+=1
        if seq[i]<seq[j]: inc+=1
for m in range(K):
    C+=((K-m)*cou+m*inc)%1000000007
    C=C%1000000007
C=C%1000000007
print(C)

Fixed submission:
N,K=(input().split())
N,K=int(N),int(K)
seq=list(input().split())
seq=[int(x) for x in seq]
cou=0
C=0
inc=0
for i in range(len(seq)):
    for j in range(i+1,len(seq)):
        if seq[i]>seq[j]: cou+=1
for i in range(len(seq)):
    for j in range(len(seq)):
        if seq[i]>seq[j]: inc+=1
C=(K*(K-1)//2)*inc+K*cou
print(C%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
min = float("inf")
for i in range(L, R + 1):
	for j in range(i + 1, R + 1):
		mod = ((i % 2019) * (j % 2019)) % 2019
		if min > mod:
			min = mod
print(min)


Fixed submission:
L, R = map(int, input().split())
# min = float("inf")
# for i in range(L, R + 1):
# 	for j in range(i + 1, R + 1):
# 		mod = ((i % 2019) * (j % 2019)) % 2019
# 		if min > mod:
# 			min = mod

# 2019 = 3 * 673

if R - L >= 2019:
	print(0)
else:
	R %= 2019
	L %= 2019
	if L > R:
		R += 2019
	min = float("inf")
	for i in range(L, R + 1):
		for j in range(i + 1, R + 1):
			mod = ((i % 2019) * (j % 2019)) % 2019
			if min > mod:
				min = mod
	print(min)

# 2020 2040 -> 1 21
# 2010 2030 -> 2010 11
Buggy python submission (verdict: Runtime Error):
N, weight_capacity = (int(n) for n in input().split())
weights, values = [], []
for _ in range(N):
    w, v = (int(n) for n in input().split())
    weights.append(w)
    values.append(v)

def knapsack_dp(weight_capacity, weights, values):
    """Solve knapsack problem by dynamic programming"""
    N = len(weights)
    dp = [[0] * (weight_capacity + 1) for _ in range(len(weights) + 1)]

    for i in range(N + 1):
        for w in range(weight_capacity + 1):
            if w >= weights[i]:
                dp[i + 1][w] = max(dp[i][w], dp[i][w - weights[i]] + values[i])
            else:
                dp[i + 1][w] = dp[i][w]

    return dp[N][weight_capacity]

print(knapsack_dp(weight_capacity, weights, values))


Fixed submission:
N, W = (int(n) for n in input().split())
w, v = [], []
for _ in range(N):
    w_, v_ = (int(n) for n in input().split())
    w.append(w_)
    v.append(v_)

dp = [[0] * (W + 1) for _ in range(N + 1)]

for i in range(N):
    for w_ in range(W + 1):
        if w_ >= w[i]:
            dp[i + 1][w_] = max(dp[i][w_], dp[i][w_ - w[i]] + v[i])
        else:
            dp[i + 1][w_] = dp[i][w_]

print(dp[N][W])

Buggy python submission (verdict: Time Limit Exceeded):
N, W = (int(n) for n in input().split())
w, v = [], []
for _ in range(N):
    w_, v_ = (int(n) for n in input().split())
    w.append(w_)
    v.append(v_)

dp = [[0] * (W + 1) for _ in range(N + 1)]

for i in range(N):
    for w_ in range(W + 1):
        if w_ >= w[i]:
            dp[i + 1][w_] = max(dp[i][w_], dp[i][w_ - w[i]] + v[i])
        else:
            dp[i + 1][w_] = dp[i][w_]

print(dp[N][W])

Fixed submission:
N, W = (int(n) for n in input().split())
w, v = [], []
for _ in range(N):
    w_, v_ = (int(n) for n in input().split())
    w.append(w_)
    v.append(v_)

dp = [[0] * (W + 1) for _ in range(N + 1)]

for i in range(N):
    for w_ in range(W + 1):
        if w_ >= w[i]:
            dp[i + 1][w_] = max(dp[i][w_], dp[i][w_ - w[i]] + v[i])
        else:
            dp[i + 1][w_] = dp[i][w_]

print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()

dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i + 1][j + 1] = dp[i][j] + 1
        else:
            dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1])

ret_rev = []

i, j = len(s) - 1, len(t) - 1
while i >= 0 and j >= 0:
    if s[i] == t[j]:
        ret_rev.append(s[i])
        i, j = i - 1, j - 1
    elif dp[i + 1][j + 1] == dp[i + 1][j]:
        i, j = i, j - 1
    else: # i.e. dp[i + 1][j + 1] == dp[i][j + 1]
        i, j = i - 1, j

ret = "".join(ret_rev[::-1])

print(ret)


Fixed submission:
s = input()
t = input()

dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i + 1][j + 1] = dp[i][j] + 1
        else:
            dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1])

ret_rev = ""

i, j = len(s) - 1, len(t) - 1
while i >= 0 and j >= 0:
    if s[i] == t[j]:
        ret_rev += s[i]
        i, j = i - 1, j - 1
    elif dp[i + 1][j] == dp[i][j]:
        i, j = i - 1, j
    else: # i.e. dp[i][j + 1] == dp[i][j]
        i, j = i, j - 1

ret = ret_rev[::-1]

print(ret)
Buggy python submission (verdict: Runtime Error):
N, H = map(int, input().split())
B = []
a_max = 0
for i in range(N):
    a, b = map(int, input().split())
    a_max = max(a_max, a)
    B.append(b)

B = sorted([b for b in B if b > a_max], reverse = True)

cnt = 0
for b in B:
    H -= b
    cnt += 1
    if H <= 0:
	break
if H > 0:
    cnt += ((H-1) // a_max) + 1


print(cnt)


Fixed submission:
N, H = map(int, input().split())
B = []
a_max = 0
for i in range(N):
    a, b = map(int, input().split())
    a_max = max(a_max, a)
    B.append(b)

B = sorted([b for b in B if b > a_max], reverse = True)

cnt = 0
for b in B:
    H -= b
    cnt += 1
    if H <= 0:
        break
if H > 0:
    cnt += ((H-1) // a_max) + 1


print(cnt)

Buggy python submission (verdict: Runtime Error):
N, H = map(int, input().split())
B = []
a_max = 0
for i in range(N):
    a, b = map(int, input().split())
    a_max = max(a_max, a)
    B.append(b)

B = sorted([b for b in B if b > a_max], reverse = True)

cnt = 0
for b in B:
    H -= b
    cnt += 1
    if H <= 0:
	break
if H > 0:
    cnt += ((H-1) // a_max) + 1


print(cnt)


Fixed submission:
N, H = map(int, input().split())
B = []
a_max = 0
for i in range(N):
    a, b = map(int, input().split())
    a_max = max(a_max, a)
    B.append(b)

B = sorted([b for b in B if b > a_max], reverse = True)

cnt = 0
for b in B:
    H -= b
    cnt += 1
    if H <= 0:
        break
if H > 0:
    cnt += ((H-1) // a_max) + 1


print(cnt)
Buggy python submission (verdict: Runtime Error):
Q = int(input())


M = 10**5 + 5
primes = [True] * M
primes[0] = False
primes[1] = False


for i in range(2, M):
    if primes[i]:
        for j in range(2, M//i):
            primes[i*j] = False

cnt = [0] * M

for i in range(3, M):
    cnt[i] = cnt[i-1]
    if primes[i] and primes[(i+1)//2]:
        cnt[i] += 1

for q in range(Q):
    l, r = map(int, input().split())
    print(cnt[r] - cnt[l-1])


Fixed submission:
print(48-int(input()))
Buggy python submission (verdict: Runtime Error):
Q = int(input())

M = 10**5+5
primes = [True] * M
primes[0] = False
primes[1] = False


for i in range(2, M):
    if primes[i]:
        for j in range(2, M//i+1):
            primes[i*j] = False

print(primes)
cnt = [0] * M

for i in range(3, M):
    cnt[i] = cnt[i-1]
    if primes[i] and primes[(i+1)//2]:
        cnt[i] += 1
print(cnt)
queues = []
for q in range(Q):
    l, r = map(int, input().split())
    queues.append((l, r))

for l, r in queues:
    print(cnt[r] - cnt[l-1])


Fixed submission:
Q = int(input())

M = 10**5+5
primes = [True] * M
primes[0] = False
primes[1] = False


for i in range(2, M):
    if primes[i]:
        for j in range(2, (M-1)//i+1):
            primes[i*j] = False

# print(primes)                                                                    
cnt = [0] * M

for i in range(3, M):
    cnt[i] = cnt[i-1]
    if primes[i] and primes[(i+1)//2]:
        cnt[i] += 1
# print(cnt)                                                                       
queues = []
for q in range(Q):
    l, r = map(int, input().split())
    queues.append((l, r))

for l, r in queues:
    print(cnt[r] - cnt[l-1])
Buggy python submission (verdict: Runtime Error):
s = input() + "T"
x, y = map(int, input().split())
N = len(s)



for i in range(N):
    if s[i] == "F":
        x -= 1
    else:
        cnt_Y = True
        index = i + 1
        break

steps_X = []
steps_Y = []

while index < N:
    cnt = 0
    for j in range(index, N):
        if s[j] == "F":
            cnt += 1
        else:
            if cnt_Y and cnt != 0:
                steps_Y.append(cnt)
            elif not cnt_Y and cnt != 0:
                steps_X.append(cnt)
            cnt_Y = not cnt_Y
            index = j
            break
    index += 1
    
K = 10000
dp = [set() for _ in range(K)]
dp[0].add(0)

for i, t in enumerate(steps_X):
    for tmp in dp[i]:
        dp[i+1].add(tmp+t)
        dp[i+1].add(tmp-t)

# print(dp[len(steps_X)])
if x not in dp[len(steps_X)]:
    print("No")
    import sys
    sys.exit()

dp = [set() for _ in range(K)]
dp[0].add(0)
for i, t in enumerate(steps_Y):
    for tmp in dp[i]:
        dp[i+1].add(tmp+t)
        dp[i+1].add(tmp-t)

if y not in dp[len(steps_Y)]:
    print("No")
    import sys
    sys.exit()


print("Yes")


Fixed submission:
N = int(input())
A = [int(n) for n in input().split()]

from collections import Counter

cnt = Counter(A)

res = 0
for k, v in cnt.items():
    if k <= v:
        res += v-k
    else:
        res += v

print(res)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(n) for n in input().split()]
infty = 10**15
res = 0
edge = [[0]*(N+2) for _ in range(N+2)]

for i, t in enumerate(a):
    if t > 0:
        edge[i][N+1] = t
        res += t
    else:
        edge[N][i] = -t

for i in range(1, N+1):
    for j in range(2, N//i + 1):
        edge[i-1][i*j-1] = infty


def dfs(now):
    checked[now] = True
    if now == N+1:
        return 1
    for nx in range(N+2):
        if nx != now and edge[now][nx] > 0 and checked[nx] == False:
            if dfs(nx) > 0:
                edge[now][nx] -= 1
                edge[nx][now] += 1
                return 1
    return 0



# print(res)
while(True):
    checked = [False] * (N+2)
    checked[N] = True
    if dfs(N) > 0:
        res -= 1
    else:
        break

print(res)


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

one = 100 * (N-M) + 1900 * M
count = 2 ** M
print(one * count)
Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = [int(n) for n in input().split()]

max_ratio = 0
for cnt_A in [n for n in range(30) if 100*A*n <= F]:
  for cnt_B in [n for n in range(30) if 100*A*cnt_A * 100*B*n <= F]:
    for cnt_C in [n for n in range(1500) if n*C <= E*(A*cnt_A+B*cnt_B) and 100*A*cnt_A + 100*B*cnt_B + n*C <= F]:
      for cnt_D in [n for n in range(1500) if n*D + C*cnt_C <= E*(A*cnt_A + B*cnt_B)and 100*A*cnt_A + 100*B*cnt_B + C*cnt_C + D*n <= F]:
        if (cnt_A!=0 or cnt_B !=0)and max_ratio < (C*cnt_C+D*cnt_D)/(100*A*cnt_A+100*B*cnt_B):
          max_ratio = (C*cnt_C + D*cnt_D)/(100*A*cnt_A+100*B*cnt_B)
          a = 100*A*cnt_A + 100*B*cnt_B
          b = C*cnt_C + D*cnt_D
print(a+b, b)


Fixed submission:
A, B, C, D, E, F = [int(n) for n in input().split()]

max_ratio = -1
for cnt_A in [n for n in range(30) if 100*A*n <= F]:
  for cnt_B in [n for n in range(30) if 100*A*cnt_A * 100*B*n <= F]:
    for cnt_C in [n for n in range(1500) if n*C <= E*(A*cnt_A+B*cnt_B) and 100*A*cnt_A + 100*B*cnt_B + n*C <= F]:
      for cnt_D in [n for n in range(1500) if n*D + C*cnt_C <= E*(A*cnt_A + B*cnt_B)and 100*A*cnt_A + 100*B*cnt_B + C*cnt_C + D*n <= F]:
        if (cnt_A!=0 or cnt_B !=0)and max_ratio < (C*cnt_C+D*cnt_D)/(100*A*cnt_A+100*B*cnt_B):
          max_ratio = (C*cnt_C + D*cnt_D)/(100*A*cnt_A+100*B*cnt_B)
          a = 100*A*cnt_A + 100*B*cnt_B
          b = C*cnt_C + D*cnt_D
print(a+b, b)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd

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

res = 1
for t in T:
  res = int(res/(gcd(res, t))) * t
print(res)

Fixed submission:
import sys

N = input()

for i in range(len(N)):
  if N[i] != N[len(N)-1-i]:
    print("No")
    sys.exit()

print("Yes")
Buggy python submission (verdict: Runtime Error):
from fractions import gcd

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

res = 1
for t in T:
  res = int(res/(gcd(res, t))) * t
print(res)

Fixed submission:
from fractions import gcd

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

res = 1
for t in T:
  res = res // gcd(res, t) * t
print(res)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

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

res = 1
for t in T:
  res = int(res * t /(gcd(res, t)))
print(res)

Fixed submission:
from fractions import gcd

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

res = 1
for t in T:
  res = res // gcd(res, t) * t
print(res)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

N = int(input())
T = []
for i in range(N):
  T.append(long(input()))

res = 1L
for t in T:
  res = long(res * t /(gcd(res, t)))
print(res)

Fixed submission:
from fractions import gcd

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

res = 1
for t in T:
  res = res // gcd(res, t) * t
print(res)

Buggy python submission (verdict: Runtime Error):
from math import gcd

N = int(input())
T = []
for i in range(N):
  T.append(long(input()))

res = 1L
for t in T:
  res = long(res * t /(gcd(res, t)))
print(res)

Fixed submission:
from fractions import gcd

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

res = 1
for t in T:
  res = res // gcd(res, t) * t
print(res)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

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

res = 1
for t in T:
  res = int(res * t /(gcd(res, t)))
print(res)

Fixed submission:
from fractions import gcd

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

res = 1
for t in T:
  res = res // gcd(res, t) * t
print(res)

Buggy python submission (verdict: Runtime Error):
from math import gcd

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

res = 1
for t in T:
  res = int(res * t /(gcd(res, t)))
print(res)

Fixed submission:
from fractions import gcd

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

res = 1
for t in T:
  res = res // gcd(res, t) * t
print(res)

Buggy python submission (verdict: Runtime Error):
from math import gcd

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

res = 1
for t in T:
  res = int(res * t /(gcd(res, t)))
print(res)

Fixed submission:
from fractions import gcd

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

res = 1
for t in T:
  res = res // gcd(res, t) * t
print(res)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)

N = int(input())
adj = [[] for n in range(N)]
for i in range(N-1):
  a, b = [int(n)-1 for n in input().split()]
  adj[a].append(b)
  adj[b].append(a)



def dfs(now, cost, dic):
  dic[now] = cost
  for nx in adj[now]:
    if nx not in dic:
      dfs(nx, cost+1, dic)

dist_f = {}
dist_s = {}

dfs(0, 0, dist_f)
dfs(N-1, 0, dist_s)


f_cnt = 0
for  i in range(N):
  if dist_f[i] <= dist_s[i]:
    f_cnt += 1

if f_cnt > N-f_cnt:
  print("Fennec")
else:
  print("Snuke")

Fixed submission:
A, B = [int(n) for n in input().split()]
if A%3==0 or B%3==0 or (A+B)%3==0:
  print("Possible")
else:
  print("Impossible")

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)

N = int(input())
adj = [[] for n in range(N)]
for i in range(N-1):
  a, b = [int(n)-1 for n in input().split()]
  adj[a].append(b)
  adj[b].append(a)



def dfs(now, cost, dic):
  dic[now] = cost
  for nx in adj[now]:
    if nx not in dic:
      dfs(nx, cost+1, dic)

dist_f = {}
dist_s = {}

dfs(0, 0, dist_f)
dfs(N-1, 0, dist_s)


f_cnt = 0
for  i in range(N):
  if dist_f[i] <= dist_s[i]:
    f_cnt += 1

if f_cnt > N-f_cnt:
  print("Fennec")
else:
  print("Snuke")

Fixed submission:
A, B = [int(n) for n in input().split()]
if A%3==0 or B%3==0 or (A+B)%3==0:
  print("Possible")
else:
  print("Impossible")