Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import sys
n, m = map(int, input().split())
s = input()
t = input()
if s[0]==t[0]:
    g = gcd(n, m)
    x = g*(n//g)*(m//g)
    num_s, num_t = x//n, x//m
    for i in range(x):
        if (i-1)%num_s==0 and (i-1)%num_t==0:
            if s[(i-1)//num_s] == t[(i-1)//num_t]:
                continue
            else:
                print(-1)
                sys.exit()
    print(x)
else:
    print(-1)

Fixed submission:
from fractions import gcd
import sys
n, m = map(int, input().split())
s = input()
t = input()
if s[0]==t[0]:
    g = gcd(n, m)
    x = g*(n//g)*(m//g)
    num_s, num_t = x//n, x//m
    for i in range(0, x, num_s):
        if i%num_t==0 and s[i//num_s]!=t[i//num_t]:
            print(-1)
            sys.exit()
    print(x)
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import sys
n, m = map(int, input().split())
s = input()
t = input()
if s[0]==t[0]:
    result = ""
    g = gcd(n, m)
    x = g*(n//g)*(m//g)
    num_s, num_t = x//n, x//m
    for i in range(x):
        if (i-1)%num_s==0 and (i-1)%num_t==0:
            if s[(i-1)//num_s] == t[(i-1)//num_t]:
                result = result+s[(i-1)//num_s]
            else:
                print(-1)
                sys.exit()
        elif (i-1)%num_s==0:
            result = result+s[(i-1)//num_s]
        elif (i-1)%num_t==0:
            result = result+t[(i-1)//num_t]
        else:
            result = result+"a"
    print(x)
else:
    print(-1)

Fixed submission:
from fractions import gcd
import sys
n, m = map(int, input().split())
s = input()
t = input()
if s[0]==t[0]:
    g = gcd(n, m)
    x = g*(n//g)*(m//g)
    num_s, num_t = x//n, x//m
    for i in range(0, x, num_s):
        if i%num_t==0 and s[i//num_s]!=t[i//num_t]:
            print(-1)
            sys.exit()
    print(x)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import math
n, X = map(int, input().split(' '))
x = list(map(int, input().split(' ')))
x = [abs(X-i) for i in x]
c = x[0]
for i in range(1, n):
    c = math.gcd(c, x[i])

print(c)

Fixed submission:
n, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
y = [x[i+1]-x[i] for i in range(n)]

def eu(a, b):
    a, b = sorted([a,b])
    while a != 0:
        b, a = a, b%a
    return b
d = y[0]
for i in range(1, n):
    d = eu(d, y[i])
print(d)

Buggy python submission (verdict: Runtime Error):
import math
n, X = map(int, input().split(' '))
x = list(map(int, input().split(' ')))
x = [abs(X-i) for i in x]
c = x[0]
for i in range(1, n):
    gc = math.gcd(c, x[i])
    if c <= gc:
        continue
    else:
        c = gc
print(c)

Fixed submission:
n, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
y = [x[i+1]-x[i] for i in range(n)]

def eu(a, b):
    a, b = sorted([a,b])
    while a != 0:
        b, a = a, b%a
    return b
d = y[0]
for i in range(1, n):
    d = eu(d, y[i])
print(d)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int,input().split())
bord = [[0 for _j in range(n+2)] for _i in range(n+2)]

for _i in range(m):
    left, right = map(int, input().split())
    bord[left][right] += 1

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

result = []
for _i in range(q):
    p, q = map(int, input().split())
    c = 0
    for i in range(p, q+1):
        c += bord[i][q]-bord[i][p-1]
    result.append(c)
print(*result)

Fixed submission:
n, m, q = map(int,input().split())
bord = [[0 for _j in range(n+2)] for _i in range(n+2)]

for _i in range(m):
    left, right = map(int, input().split())
    bord[left][right] += 1

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

result = []
for _i in range(q):
    p, q = map(int, input().split())
    c = 0
    for i in range(p, q+1):
        c += bord[i][q]-bord[i][p-1]
    result.append(c)
print(*result)

Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int,input().split())
bord = [[0 for _j in range(n+1)] for _i in range(n+1)]

for _i in range(m):
    left, right = map(int, input().split())
    bord[left][right] += 1
result = []
for _i in range(q):
    p, q = map(int, input().split())
    c = 0
    for i in range(p, q+1):
        for j in range(p, q+1):
            c += bord[i][j]
    result.append(c)
print(*result)

Fixed submission:
n, m, q = map(int,input().split())
bord = [[0 for _j in range(n+2)] for _i in range(n+2)]

for _i in range(m):
    left, right = map(int, input().split())
    bord[left][right] += 1

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

result = []
for _i in range(q):
    p, q = map(int, input().split())
    c = 0
    for i in range(p, q+1):
        c += bord[i][q]-bord[i][p-1]
    result.append(c)
print(*result)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a = [a[i]-i for i in range(n)]

import numpy as np
a = np.array(a)
x = np.median(a)
r = 0
for i in range(n):
    r += abs(a[i]-x)
print(int(r))

Fixed submission:
n = int(input())
a = list(map(int, input().split(' ')))
a = [a[i]-i-1 for i in range(n)]
a.sort()
if n%2 == 0:
    num = int(n/2)
    b = int((a[num-1]+a[num])/2)
    a = [abs(a[i]-b) for i in range(n)]
else:
    num = int(n/2)
    b = int(a[num])
    a = [abs(a[i]-b) for i in range(n)]
print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
result = []
for i in range(n-1):
    w = s[:i].count("W")
    e = s[i+1:].count("E")
    result.append(w+e)
print(min(result))

Fixed submission:
n = int(input())
s = list(input())
result = [s[1:].count("E")]
for i in range(n-1):
    if s[i:i+2] == ["W","W"]:
        result.append(result[-1]+1)
    elif s[i:i+2] == ["E","E"]:
        result.append(result[-1]-1)
    else:
        continue
print(min(result))
Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
s += '0'
k = int(input())
result = []
if k > len(s):
    for i in range(1, k+1):
        for j in range(len(s)-i):
            result.append(s[j:j+i])
else:
    for i in range(len(s)):
        for j in range(i+1, len(s)):
            result.append(s[i:j])
r = set(result)
out = list(r)
out.sort()

print(out[k-1])

Fixed submission:
def main():
    s = str(input())
    s += '0'
    k = int(input())
    result = set()
    for i in range(1, 6):
        for j in range(len(s)-i):
            result.add(s[j:j+i])
    out = list(result)
    out.sort()
    print(out[k-1])
if __name__ =='__main__':
    main()

Buggy python submission (verdict: Runtime Error):
s = str(input())
k = int(input())
result = []
for i in range(1, k+1):
    for j in range(len(s)-i):
        result.append(s[j:j+i])
r = set(result)
out = list(r)
out.sort()
print(out[k-1])

Fixed submission:
def main():
    s = str(input())
    s += '0'
    k = int(input())
    result = set()
    for i in range(1, 6):
        for j in range(len(s)-i):
            result.add(s[j:j+i])
    out = list(result)
    out.sort()
    print(out[k-1])
if __name__ =='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
k = int(input())
s += '0'
result = []
for i in range(1, k+1):
    for j in range(len(s)-i):
        if all(s[j:j+i] != x for x in result):
            result.append(s[j:j+i])
result.sort()
print(result[k-1])

Fixed submission:
def main():
    s = str(input())
    s += '0'
    k = int(input())
    result = set()
    for i in range(1, 6):
        for j in range(len(s)-i):
            result.add(s[j:j+i])
    out = list(result)
    out.sort()
    print(out[k-1])
if __name__ =='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
k = int(input())
s += '0'
result = []
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        if all(s[i:j] != x for x in result):
            result.append(s[i:j])
result.sort()

print(result[k-1])

Fixed submission:
def main():
    s = str(input())
    s += '0'
    k = int(input())
    result = set()
    for i in range(1, 6):
        for j in range(len(s)-i):
            result.add(s[j:j+i])
    out = list(result)
    out.sort()
    print(out[k-1])
if __name__ =='__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for _ in range(n)]
result = 0
for i in range(n):
    a = 1
    for x in range(n):
        if any(s[(x+i)%n][y] != s[(y+i)%n][x] for y in range(x, n)):
            a = 0
            break
    result += a
print(result*n)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
result = 0
for i in range(n):
    h = True
    for x in range(n):
        if all(s[(x+i)%n][y]==s[(y+i)%n][x] for y in range(x, n)):
            continue
        else:
            h = False
            break
    if h:
        result += 1
print(result*n)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for _ in range(n)]
result = 0
for i in range(n):
    h = True
    for x in range(n):
        if all(s[(x+i)%n][y]==s[(y+i)%n][x] for y in range(x, n)):
            continue
        else:
            h = False
            break
    if h:
        result += 1
print(result*n)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
result = 0
for i in range(n):
    h = True
    for x in range(n):
        if all(s[(x+i)%n][y]==s[(y+i)%n][x] for y in range(x, n)):
            continue
        else:
            h = False
            break
    if h:
        result += 1
print(result*n)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for _ in range(n)]
result = 0
for i in range(n):
    h = True
    for x in range(n):
        for y in range(x, n):
            if s[(x+i)%n][y]==s[(y+i)%n][x]:
                continue
            else:
                h = False
                break
        if h==False:
            break
    if h:
        result += 1
print(result*n)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
result = 0
for i in range(n):
    h = True
    for x in range(n):
        if all(s[(x+i)%n][y]==s[(y+i)%n][x] for y in range(x, n)):
            continue
        else:
            h = False
            break
    if h:
        result += 1
print(result*n)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
a = sorted(x)

mid_n = len(a)//2
for i in range(n):
    if a.index(x[i]) < mid_n:
        print(a[mid_n])
    else:
        print(a[mid_n-1])

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
a = sorted(x)

mid_n = len(a)//2
right = a[mid_n]
left = a[mid_n-1]

for i in range(n):
    if right > x[i]:
        print(right)
    else:
        print(left)
Buggy python submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split(' '))
    result = [n//i*max(0,i-k) + max(0, n%i-k+1) for i in range(1, n+1)]
    if k == 0:
        result -= n
    print(result)
main()

Fixed submission:
n, k = map(int, input().split(' '))
result = 0
for i in range(1, n+1):
    p = n//i
    result += p*max(0,i-k)
    result += max(0, n%i-k+1)
    if k == 0:
        result -= 1
print(result)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = [int(input()) for i in range(n)]
d.sort(reverse=True)
result = []
for i in range(n-1):
    count = 1
    if all(d[x] == d[i] for x in range(i,n)):
        count = 1
    else:
        if d[i] == d[i+1]:
            count += 1
        for j in range(i, n-1):
            if d[j] > d[j+1]:
                count += 1
    result.append(count)
print(max(result))

Fixed submission:
n = int(input())
d = [int(input()) for i in range(n)]
d.sort(reverse=True)
count = 1
for i in range(n-1):
    if d[i]> d[i+1]:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = [int(input()) for i in range(n)]
d.sort(reverse=True)
result = []
for i in range(n-1):
    count = 1
    if all(d[x] == d[i] for x in range(i,n)):
        count = 1
    else:
        if d[i] == d[i+1]:
            count += 1
        for j in range(n-i-1):
            if d[j+i] > d[j+i+1]:
                count += 1
    result.append(count)
print(max(result))


Fixed submission:
n = int(input())
d = [int(input()) for i in range(n)]
d.sort(reverse=True)
count = 1
for i in range(n-1):
    if d[i]> d[i+1]:
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n, h = list(map(int, input().split(' ')))
k = [list(map(int, input().split(' '))) for _ in range(n)]
a = []
b = []
for i in range(n):
    a.append(k[i][0])
    b.append(k[i][1])

a.sort(reverse = True)
b.sort(reverse = True)
a.append(0)
b.append(0)
count = 0
x = 0
y = 0

while h > 0:
    if a[x] <= b[y]:
        h -= b[y]
        y += 1
        count += 1
    elif a[x] > b[y]:
        h -= a[x]
        count += 1
print(count)

Fixed submission:
n, h = list(map(int, input().split(' ')))
k = [list(map(int, input().split(' '))) for _ in range(n)]
a = []
b = []
for i in range(n):
    a.append(k[i][0])
    b.append(k[i][1])

a.sort(reverse = True)
b.sort(reverse = True)
a.append(0)
b.append(0)
count = 0
x = 0
y = 0

while h > 0:
    if a[x] <= b[y]:
        h -= b[y]
        y += 1
        count += 1
    elif a[x] > b[y]:
        count += h//a[x]
        if h%a[x] != 0:
            count += 1
        h = 0
print(count)

Buggy python submission (verdict: Runtime Error):
n, h = list(map(int, input().split(' ')))
a, b = [list(map(int, input().split(' '))) for _ in range(n)]

a.sort(reverse = True)
b.sort(reverse = True)
a.append(0)
b.append(0)
count = 0
x = 0
y = 0

while h < 0:
    if a[x] <= b[y]:
        h -= b[y]
        y += 1
        count += 1
    elif a[x] > b[y]:
        h -= a[x]
        count += 1
print(count)

Fixed submission:
n, h = list(map(int, input().split(' ')))
k = [list(map(int, input().split(' '))) for _ in range(n)]
a = []
b = []
for i in range(n):
    a.append(k[i][0])
    b.append(k[i][1])

a.sort(reverse = True)
b.sort(reverse = True)
a.append(0)
b.append(0)
count = 0
x = 0
y = 0

while h > 0:
    if a[x] <= b[y]:
        h -= b[y]
        y += 1
        count += 1
    elif a[x] > b[y]:
        count += h//a[x]
        if h%a[x] != 0:
            count += 1
        h = 0
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
q = int(input())
def solve(num):
    ans = pow(2, num-1, num)
    ANS = pow(2, (num+1)//2 -1, (num+1)//2)
    if num == 2:
        ans = 1
    if (num+1)//2 == 2:
        ANS = 1
    if num < 2:
        ans = 10**9
    if ans == 1 and ANS == 1:
        return 1
    else:
        return 0
dt = [list(map(int, input().split())) for _ in range(q)]
for i in range(q):
    l, r = dt[i]
    c = 0
    while l <= r:
        c += solve(l)
        l += 2
    print(c)

Fixed submission:
q = int(input())
lr = [list(map(int, input().split())) for _ in range(q)]

def sosuu(num):
    Result = True
    for i in range(2, int(num**(1/2))+1):
        if num%i==0:
            Result = False
            break
    return Result #素数なら True

checker = [1 for i in range(10**5+1)]
checker[0] = 0
checker[1] = 0
for i in range(2, 10**5+1):
    if checker[i]:
        if sosuu(i):
            j = 2
            while i*j <= 10**5:
                checker[i*j] = 0
                j += 1
result = [0]
j = 0
for i in range(1, len(checker)):
    if checker[i] and checker[(i+1)//2]:
        j += 1
    result.append(j)

for l, r in lr:
    print(result[r]-result[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
x, y = map(int, input().split())

z = [0]
for i in s:
    if i=='F':
        z[-1] += 1
    else:
        z.append(0)
_y = len(z)//2
_x = len(z) - _y
len_s = len(s)
dp_x = [0 for _i in range((2*len_s+2))]
dp_x_to = [0 for _i in range((2*len_s+2))]
dp_y = [0 for _i in range((2*len_s+2))]
dp_y_to = [0 for _i in range((2*len_s+2))]

dp_x[z[0]] = 1
dp_y[0] = 1

for i in range(1, len(z)):
    if i%2==0:
        for j in range(-len_s, len_s+1):
            dp_x_to[j] = max(
                dp_x[j-z[i]],
                dp_x[j+z[i]]
            )
        dp_x = dp_x_to.copy()
    else:
        for j in range(-len_s, len_s+1):
            dp_y_to[j] = max(
                dp_y[j-z[i]],
                dp_y[j+z[i]]
            )
        dp_y = dp_y_to.copy()

if dp_x[x] == dp_y[y] == 1:
    print('Yes')
else:
    print('No')

Fixed submission:
s = list(input())
x, y = map(int, input().split())

z = [0]
for i in s:
    if i=='F':
        z[-1] += 1
    else:
        z.append(0)
_y = len(z)//2
_x = len(z) - _y
len_s = len(s)
dp_x = [0 for _i in range((2*len_s+2))]
dp_x_to = [0 for _i in range((2*len_s+2))]
dp_y = [0 for _i in range((2*len_s+2))]
dp_y_to = [0 for _i in range((2*len_s+2))]

dp_x[z[0]] = 1
dp_y[0] = 1

for i in range(1, len(z)):
    if i%2==0:
        for j in range(-len_s, len_s+1):
            dp_x_to[j] = max(
                dp_x[j-z[i]],
                dp_x[j+z[i]]
            )
        dp_x = dp_x_to.copy()
    else:
        for j in range(-len_s, len_s+1):
            dp_y_to[j] = max(
                dp_y[j-z[i]],
                dp_y[j+z[i]]
            )
        dp_y = dp_y_to.copy()

if dp_x[x] == dp_y[y] == 1:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, C = map(int,input().split())
cha = [[] for _ in range(C+1)]
stc = [list(map(int, input().split())) for _ in range(n)]
stc.sort()
for s, t, c in stc:
    cha[c].append([s, t])
result = np.zeros(2*10**5)
for i in range(1, C+1):
    x = np.zeros(2*10**5)
    for s, t in cha[i]:
        x[s*2-(x[s*2-1]==0)+2*(x[s*2]==1):t*2] += 1
    result += x
print(int(max(result)))

Fixed submission:
import numpy as np
n, C = map(int,input().split())
cha = [[[0,0]] for _ in range(C+1)]
stc = [list(map(int, input().split())) for _ in range(n)]
stc.sort()
for s, t, c in stc:
    if cha[c][-1][1]==s:
        cha[c][-1][1] = t
    else:
        cha[c].append([s, t])
result = np.zeros(2*10**5)
for i in range(1, C+1):
    for s, t in cha[i]:
        result[s*2-1:t*2] += 1
print(int(max(result)))
Buggy python submission (verdict: Runtime Error):
n = input()
for i in range(2):
    if n[i]==n[i+1] and n[i]==n[i+2]:
        print("Yes")
        sys.exit()
print("No")

Fixed submission:
import sys
n = input()
for i in range(2):
    if n[i]==n[i+1] and n[i]==n[i+2]:
        print("Yes")
        sys.exit()
print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()

b_bt = []
c_bt = []
for i in range(n):
    b_bt.append(bisect.bisect_left(a, b[i]))
    c_bt.append(bisect.bisect_left(b, c[i])-1)
result = 0
for i in range(n):
    if c_bt[i] >= 0:
        result += sum(b_bt[:c_bt[i]+1])
print(result)

Fixed submission:
import bisect

n = int(input())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()

result = 0
for i in range(n):
    x = bisect.bisect_left(a, b[i])
    y = n - bisect.bisect_right(c, b[i])
    result += x*y


print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()

def solve(num, next_list):
    left = len(next_list)-1
    right = 0
    if num <= next_list[right]:
        right = -1
    elif num <= next_list[left]:
        mid = (left+right)//2
        while mid != right:
            if num <= next_list[mid]:
                left = mid
            else:
                right = mid
            mid = (left+right)//2
    else:
        right = left
    return right

b_bt = []
c_bt = []
for i in range(n):
    b_bt.append(solve(b[i], a)+1)
    c_bt.append(solve(c[i], b))
result = 0

for i in range(n):
    if c_bt[i] >= 0:
        result += sum(b_bt[:c_bt[i]+1])
print(result)

Fixed submission:
import bisect

n = int(input())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()

result = 0
for i in range(n):
    x = bisect.bisect_left(a, b[i])
    y = n - bisect.bisect_right(c, b[i])
    result += x*y


print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())

for i in range(1, 3501):
    for j in range(1, 3501):
        x = 4*i*j-n*i-n*j
        if x > 0:
            if (n*i*j)%x == 0:
                print(i, j, n*i*j//x)
                sys.exit()

Fixed submission:
import sys
n = int(input())

for i in range(1, 3501):
    for j in range(1, 3501):
        if 4*i*j-n*i-n*j > 0:
            if (n*i*j)%(4*i*j-n*i-n*j) == 0:
                print(i, j, n*i*j//(4*i*j-n*i-n*j))
                sys.exit()
Buggy python submission (verdict: Runtime Error):
s = sorted(list(set(list(input()))))
i = 0
while i <= 25 and chr(i+97)==s[i]:
    i += 1
if i<=25:
    print(chr(i+97))
else:
    print("None")

Fixed submission:
s = sorted(list(set(list(input()))))
i = 0
while i < len(s) and chr(i+97)==s[i]:
    i += 1
if i<=25:
    print(chr(i+97))
else:
    print("None")

Buggy python submission (verdict: Runtime Error):
s = sorted(list(set(list(input()))))
i = 0
while i <= 25 and chr(i+97)==s[i]:
    i += 1
if i<=25:
    print(chr(i+97))
else:
    print("None")

Fixed submission:
s = sorted(list(set(list(input()))))
i = 0
while i < len(s) and chr(i+97)==s[i]:
    i += 1
if i<=25:
    print(chr(i+97))
else:
    print("None")
Buggy python submission (verdict: Runtime Error):
from math import gcd
n = int(input())
t = [int(input()) for _ in range(n)]
result = t[0]
for i in range(1, n):
    result = result*t[i]//gcd(result, t[i])
print(result)

Fixed submission:
from fractions import gcd
n = int(input())
t = [int(input()) for _ in range(n)]
result = t[0]
for i in range(1, n):
    result = result*t[i]//gcd(result, t[i])
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int,input().split())
ab = [[] for _ in range(n+2)]

for _ in range(m):
    a, b = map(int, input().split())
    ab[a].append(b)
    ab[b].append(a)

if any((i in ab[n]) for i in ab[1]):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
n, m = map(int,input().split())
ab = [0 for _ in range(n+2)]

for _ in range(m):
    a, b = map(int, input().split())
    if a==1:
        ab[b] += 1
        continue
    elif b == n:
        ab[a] += 1
        continue
if max(ab) == 2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(input().split())

if n%2==1:
    print(*a[n-1::-2], *a[1:n+1:2])
else:
    print(*a[n::-2], *a[:n+1:2])

Fixed submission:
n = int(input())
a = list(input().split())

if n%2==1:
    print(" ".join(a[n-1::-2]+a[1:n+1:2]))
else:
    print(" ".join(a[n::-2]+a[:n+1:2]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(input().split())
b = []
for i in range(n):
    if i%2==0:
        b = b+[a[i]]
    else:
        b = [a[i]] + b
if n%2==1:
    print(*b[::-1])
else:
    print(*b)

Fixed submission:
n = int(input())
a = list(input().split())

if n%2==1:
    print(" ".join(a[n-1::-2]+a[1:n+1:2]))
else:
    print(" ".join(a[n::-2]+a[:n+1:2]))