Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import fractions

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

def mass_gcd(L):
    # num is 1
    if len(L) == 1:
        return L[0]
    else:
        max_gcd = fractions.gcd(L[0], L[1])

    # solve gcd
    for _ in range(1, len(L) - 1):
        max_gcd = max(max_gcd, fractions.gcd(L[i], L[i + 1]))
    return max_gcd

ans = mass_gcd(A)
for i in range(0, N):
    left = A[:i]
    right = A[(i + 1):]
    if len(left) == 0:
        pass
    elif len(right) == 0:
        pass
    else:
        ans = max(ans, fractions.gcd(mass_gcd(left), mass_gcd(right)))
print(ans)

Fixed submission:
import fractions

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

# correct
L = [0] * N
R = [0] * N

for i in range(1, N):
    L[i] = fractions.gcd(L[i - 1], A[i - 1])
for j in range(0, N-1)[::-1]:
    R[j] = fractions.gcd(R[j + 1], A[j + 1])
ans = 0
for k in range(N):
    ans = max(ans, fractions.gcd(L[k], R[k]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
 
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
 
dic = {}
for a in A:
    divs = make_divisors(a)
    for i in divs:
        if dic.get(i) is None:
            dic[i] = 1
        else:
            dic[i] += 1
 
ans = 0
for k in dic:
    if dic[k] >= N - 1:
        ans = max(ans, k)
print(ans)

Fixed submission:
import fractions

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

# correct
L = [0] * N
R = [0] * N

for i in range(1, N):
    L[i] = fractions.gcd(L[i - 1], A[i - 1])
for j in range(0, N-1)[::-1]:
    R[j] = fractions.gcd(R[j + 1], A[j + 1])
ans = 0
for k in range(N):
    ans = max(ans, fractions.gcd(L[k], R[k]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

dic = {}
for a in A:
    divs = make_divisors(a)
    for i in divs:
        if dic.get(i) is None:
            dic[i] = 1
        else:
            dic[i] += 1

ans = 0
for k in dic:
    if dic[k] >= N - 1:
        ans = max(ans, k)
print(ans)

Fixed submission:
import fractions

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

# correct
L = [0] * N
R = [0] * N

for i in range(1, N):
    L[i] = fractions.gcd(L[i - 1], A[i - 1])
for j in range(0, N-1)[::-1]:
    R[j] = fractions.gcd(R[j + 1], A[j + 1])
ans = 0
for k in range(N):
    ans = max(ans, fractions.gcd(L[k], R[k]))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = list(str(input()))
agct = {'A', 'C', 'G', 'T'}

for _ in range(Q):
    l, r = map(int, input().split())

    ans = 0
    fa = 0
    for i in range(l-1, r):
        if S[i] == 'A' and fa == 0:
            fa = 1
        elif S[i] == 'C' and fa == 1:
            fa = 0
            ans += 1
        else:
            fa = 0
    print(ans)

Fixed submission:
N, Q = map(int, input().split())
S = list(str(input()))

ans_list = []
fa = 0
ans = 0
for index, s in enumerate(S):
    if s == 'A' and fa == 0:
        fa = 1
        ans_list.append(ans)
    elif s == 'A' and fa == 1:
        ans_list.append(ans)
    elif s == 'C' and fa == 1:
        fa = 0
        ans += 1
        ans_list.append(ans)
    else:
        fa = 0
        ans_list.append(ans)
for _ in range(Q):
    l, r = map(int, input().split())
    print(ans_list[r-1] - ans_list[l-1])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

like = list(map(int, input().split()))
all_like = set()
for l in like:
	all_like.add(l)
    
for i in range(N-1):
  like = list(map(int, input().split()))
  for l in like:
    if l not in all_like:
      all_like.remove(l);
print(len(all_like))

Fixed submission:
import copy

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

like = list(map(int, input().split()))
like.pop(0)
all_like = set()
for l in like:
	all_like.add(l)
    
for i in range(N-1):
  like = list(map(int, input().split()))
  like.pop(0)
  tmp = copy.deepcopy(all_like)
  for l in all_like:
    if l not in like:
      tmp.remove(l);
  all_like = tmp
print(len(all_like))

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

like = list(map(int, input().split()))
all_like = set()
for l in like:
	all_like.add(l)
for i in range(N):
  like = list(map(int, input().split()))
  for l in like:
    if l not in all_like:
      all_like.remove(l);
print(len(all_like))

Fixed submission:
import copy

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

like = list(map(int, input().split()))
like.pop(0)
all_like = set()
for l in like:
	all_like.add(l)
    
for i in range(N-1):
  like = list(map(int, input().split()))
  like.pop(0)
  tmp = copy.deepcopy(all_like)
  for l in all_like:
    if l not in like:
      tmp.remove(l);
  all_like = tmp
print(len(all_like))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()

sub_X = []
for i in range(0, M - 1):
    sub_X.append((i, abs(X[i+1] - X[i])))
sub_X.sort(key=lambda x: x[1], reverse=True)

division = set()
if len(sub_X) != 0:
    for i in range(N-1):
        division.add(sub_X[i][0])

ans = 0
start = X[0]
for i in range(M):
    if i in division:
        ans += X[i] - start
        start = X[i+1]
    if i == M-1:
        ans += X[i] - start

print(ans)

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

if N >= M:
    print(0)
else:
    sub_X = []
    for i in range(0, M - 1):
        sub_X.append((i, abs(X[i+1] - X[i])))
    sub_X.sort(key=lambda x: x[1], reverse=True)

    division = set()
    if len(sub_X) != 0:
        for i in range(N-1):
            division.add(sub_X[i][0])
    ans = 0
    start = X[0]
    for i in range(M):
        if i in division:
            ans += X[i] - start
            start = X[i+1]
        if i == M-1:
            ans += X[i] - start

    print(ans)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())


def search(level, eat_num):
    if eat_num == 0:
        if eat_num <= 0:
            return 0
        else:
            return 1

    elif eat_num == 1:
        return 0

    elif 1 < eat_num <= pow(2, level + 1) - 2:
        return search(level - 1, eat_num - 1)

    elif eat_num == pow(2, level + 1) - 1:
        return pow(2, level)

    elif pow(2, level + 1) - 1 < eat_num <= pow(2, level + 2):
        return pow(2, level) + search(level - 1, eat_num - (pow(2, level + 1) - 1))

    elif X == pow(2, level + 2) + 1:
        return pow(2, level + 1) - 1

    else:
        print('out', X)

print(search(level=N, eat_num=X))


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


def search(level, eat_num):
    if level == 0:
        if eat_num <= 0:
            return 0
        else:
            return 1

    elif eat_num == 1:
        return 0

    elif 1 < eat_num <= pow(2, level + 1) - 2:
        return search(level - 1, eat_num - 1)

    elif eat_num == pow(2, level + 1) - 1:
        return pow(2, level)

    elif pow(2, level + 1) - 1 < eat_num <= pow(2, level + 2):
        return pow(2, level) + search(level - 1, eat_num - (pow(2, level + 1) - 1))

    elif X == pow(2, level + 2) + 1:
        return pow(2, level + 1) - 1

    else:
        return pow(2, level + 1) - 1


print(search(level=N, eat_num=X))

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


def search(level, eat_num):
    if eat_num == 0:
        return 1

    elif eat_num == 1:
        return 0

    elif 1 < eat_num <= pow(2, level + 1) - 2:
        return search(level - 1, eat_num - 1)

    elif eat_num == pow(2, level + 1) - 1:
        return pow(2, level)

    elif pow(2, level + 1) - 1 < eat_num <= pow(2, level + 2):
        return pow(2, level) + search(level - 1, eat_num - (pow(2, level + 1) - 1))

    elif X == pow(2, level + 2) + 1:
        return pow(2, level + 1) - 1

    else:
        print('out', X)


print(search(level=N, eat_num=X))

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


def search(level, eat_num):
    if level == 0:
        if eat_num <= 0:
            return 0
        else:
            return 1

    elif eat_num == 1:
        return 0

    elif 1 < eat_num <= pow(2, level + 1) - 2:
        return search(level - 1, eat_num - 1)

    elif eat_num == pow(2, level + 1) - 1:
        return pow(2, level)

    elif pow(2, level + 1) - 1 < eat_num <= pow(2, level + 2):
        return pow(2, level) + search(level - 1, eat_num - (pow(2, level + 1) - 1))

    elif X == pow(2, level + 2) + 1:
        return pow(2, level + 1) - 1

    else:
        return pow(2, level + 1) - 1


print(search(level=N, eat_num=X))
Buggy python submission (verdict: Runtime Error):
nums = list(map(int, input().split()))
nums.sort()
print(nums[2] * 10 + num[1] + num[0])

Fixed submission:
nums = list(map(int, input().split()))
nums.sort()
print(nums[2] * 10 + nums[1] + nums[0])
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
mat = []
for _ in range(H):
    mat.append(list(map(int, input().split())))

ans = []
sw_rev = 0
for i in range(H):
    if sw_rev == 0:
        for j in range(W):
            if mat[i][j] % 2 != 0:
                if j == W-1:
                    if i == H-1:
                        continue
                    mat[i+1][j] += 1
                    ans.append((i, j, i+1, j))
                else:
                    mat[i][j+1] += 1
                    ans.append((i, j, i, j+1))
        sw_rev = 1
    else:
        for j in range(W)[::-1]:
            if mat[i][j] % 2 != 0:
                N += 1
                if j == 0:
                    if i == H-1:
                        continue
                    mat[i+1][j] += 1
                    ans.append((i+1, j, i, j))
                else:
                    mat[i][j-1] += 1
                    ans.append((i, j, i, j-1))
        sw_rev = 0
print(len(ans))
for x1, y1, x2, y2 in ans:
    print(x1+1, y1+1, x2+1, y2+1)

Fixed submission:
H, W = map(int, input().split())
mat = []
for _ in range(H):
    mat.append(list(map(int, input().split())))

ans = []
sw_rev = 0
for i in range(H):
    if sw_rev == 0:
        for j in range(W):
            if mat[i][j] % 2 != 0:
                if j == W-1:
                    if i == H-1:
                        continue
                    mat[i+1][j] += 1
                    ans.append((i, j, i+1, j))
                else:
                    mat[i][j+1] += 1
                    ans.append((i, j, i, j+1))
        sw_rev = 1
    else:
        for j in range(W)[::-1]:
            if mat[i][j] % 2 != 0:
                if j == 0:
                    if i == H-1:
                        continue
                    mat[i+1][j] += 1
                    ans.append((i, j, i+1, j))
                else:
                    mat[i][j-1] += 1
                    ans.append((i, j, i, j-1))
        sw_rev = 0
print(len(ans))
for x1, y1, x2, y2 in ans:
    print(x1+1, y1+1, x2+1, y2+1)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, m = map(int, input().split())
A = np.array(list(map(int, input().split())))

ans = 0
for l in range(n):
    for r in range(l, n):
        if np.sum(A[l:r + 1]) % m == 0:
            ans += 1
print(ans)

Fixed submission:
import numpy as np
from collections import Counter
import math

n, m = map(int, input().split())
A = np.array(list(map(int, input().split())))


def combinations(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

acc_sum = [0]
tmp = 0
for i in range(n):
    tmp += A[i]
    acc_sum.append(tmp % m)
acc_sum = Counter(acc_sum)
ans = 0
for k in acc_sum:
    if acc_sum[k] >= 2:
        ans += combinations(acc_sum[k], 2)
print(ans)

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

n, m = map(int, input().split())
A = np.array(list(map(int, input().split())))

ans = 0
for l in range(n):
    for r in range(l, n):
        if A[l:r + 1].sum() % m == 0:
            ans += 1
print(ans)

Fixed submission:
import numpy as np
from collections import Counter
import math

n, m = map(int, input().split())
A = np.array(list(map(int, input().split())))


def combinations(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

acc_sum = [0]
tmp = 0
for i in range(n):
    tmp += A[i]
    acc_sum.append(tmp % m)
acc_sum = Counter(acc_sum)
ans = 0
for k in acc_sum:
    if acc_sum[k] >= 2:
        ans += combinations(acc_sum[k], 2)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce


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


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


N = int(input())
a = list(map(int, input().split()))

lcm_num = lcm_list(a) - 1
ans = 0
for i in range(N):
    ans += lcm_num % a[i]
print(ans)



Fixed submission:
from functools import reduce


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm_base(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


N = int(input())
a = list(map(int, input().split()))

lcm_num = lcm_list(a) - 1
ans = 0
for i in range(N):
    ans += lcm_num % a[i]
print(ans)

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


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


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


N = int(input())
a = list(map(int, input().split()))

lcm_num = lcm_list(a) - 1
ans = 0
for i in range(N):
    ans += lcm_num % a[i]
print(ans)


Fixed submission:
from functools import reduce


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm_base(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


N = int(input())
a = list(map(int, input().split()))

lcm_num = lcm_list(a) - 1
ans = 0
for i in range(N):
    ans += lcm_num % a[i]
print(ans)

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

N = int(input())
a = list(map(int, input().split()))


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


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


lcm_num = lcm_list(a) - 1
ans = 0
for i in range(N):
    ans += lcm_num % a[i]
print(ans)


Fixed submission:
from functools import reduce


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm_base(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


N = int(input())
a = list(map(int, input().split()))

lcm_num = lcm_list(a) - 1
ans = 0
for i in range(N):
    ans += lcm_num % a[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

A_sorted = sorted([A[i] - (i+1) for i in range(N)])
b = A_sorted[int((len(A)-1)/2)]
b2 = A_sorted[int((len(A)-1)/2 + 1)]

sad_1 = sum([abs(A_sorted[i] - b) for i in range(N)])
sad_2 = sum([abs(A_sorted[i] - b2) for i in range(N)])

print(min(sad_1, sad_2))


Fixed submission:
N = int(input())

if N % 2 == 0:
    print(N)
else:
    print(2*N)

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

# res = 0
# for i in range(N):
#     res += A[i] - (i+1)
# b = res // N
# print(res, b)
A_sorted = sorted([A[i] - (i+1) for i in range(N)])
b = A_sorted[int((len(A)-1)/2)]
b2 = A_sorted[int((len(A)-1)/2 + 1)]

print(A_sorted, b, b2)
sad_1 = sum([abs(A_sorted[i] - b) for i in range(N)])
sad_2 = sum([abs(A_sorted[i] - b2) for i in range(N)])

print(min(sad_1, sad_2))

Fixed submission:
N = int(input())

if N % 2 == 0:
    print(N)
else:
    print(2*N)

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

# res = 0
# for i in range(N):
#     res += A[i] - (i+1)
# b = res // N
# print(res, b)
A_sorted = sorted(A)
b = A_sorted[int((len(A)-1)/2)]
b2 = A_sorted[int((len(A)-1)/2 + 1)]

sadness_1 = sum([abs(A[i] - b) for i in range(N)])
sadness_2 = sum([abs(A[i] - b2) for i in range(N)])

print(min(sadness_1, sadness_2))

Fixed submission:
N = int(input())

if N % 2 == 0:
    print(N)
else:
    print(2*N)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

A_sorted = sorted([A[i] - (i+1) for i in range(N)])
b = A_sorted[int((len(A)-1)/2)]
b2 = A_sorted[int((len(A)-1)/2 + 1)]

sad_1 = sum([abs(A_sorted[i] - b) for i in range(N)])
sad_2 = sum([abs(A_sorted[i] - b2) for i in range(N)])

print(min(sad_1, sad_2))


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

A_sorted = sorted([A[i] - (i+1) for i in range(N)])

if len(A) != 1:
    b = A_sorted[int((len(A)-1)/2)]
    b2 = A_sorted[int((len(A)-1)/2 + 1)]
    sad_1 = sum([abs(A_sorted[i] - b) for i in range(N)])
    sad_2 = sum([abs(A_sorted[i] - b2) for i in range(N)])
    print(min(sad_1, sad_2))
else:
    print('0')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

res = 0
for i in range(N):
    res += A[i] - (i+1)
b = res // N

ans = 99999999
for bj in range(b-100, b+100):
    res = 0
    for i in range(N):
        res += abs(A[i] - (b+(i+1)))
    ans = min(ans, res)
print(ans)

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

A_sorted = sorted([A[i] - (i+1) for i in range(N)])

if len(A) != 1:
    b = A_sorted[int((len(A)-1)/2)]
    b2 = A_sorted[int((len(A)-1)/2 + 1)]
    sad_1 = sum([abs(A_sorted[i] - b) for i in range(N)])
    sad_2 = sum([abs(A_sorted[i] - b2) for i in range(N)])
    print(min(sad_1, sad_2))
else:
    print('0')

Buggy python submission (verdict: Runtime Error):
ans = 9999999
res = 0
for i in range(N):
    res += A[i] - (i+1)

b = res // N
res = 0
for i in range(N):
    res += abs(A[i] - (b+(i+1)))
print(res)


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

A_sorted = sorted([A[i] - (i+1) for i in range(N)])

if len(A) != 1:
    b = A_sorted[int((len(A)-1)/2)]
    b2 = A_sorted[int((len(A)-1)/2 + 1)]
    sad_1 = sum([abs(A_sorted[i] - b) for i in range(N)])
    sad_2 = sum([abs(A_sorted[i] - b2) for i in range(N)])
    print(min(sad_1, sad_2))
else:
    print('0')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
s = list(input())

ans = 999999
for i in range(n):
    left = Counter(s[:i])
    right = Counter(s[i+1:])
    ans = min(ans, left['W'] + right['E'])
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
s = list(input())
num_w = 0
num_e = Counter(s[1:])['E']
ans = num_e
for i in range(1, n):
    if s[i-1] == 'W':
        num_w += 1
    if s[i] == 'E':
        num_e -= 1
    ans = min(ans, num_w + num_e)
print(ans)

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

ans = 999999999
for i in range(n):
    left = s[:i]
    right = s[i+1:]

    tmp_ans = 0
    for person in left:
        if person == 'W':
            tmp_ans += 1
    for person in right:
        if person == 'E':
            tmp_ans += 1
    ans = min(ans, tmp_ans)
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
s = list(input())
num_w = 0
num_e = Counter(s[1:])['E']
ans = num_e
for i in range(1, n):
    if s[i-1] == 'W':
        num_w += 1
    if s[i] == 'E':
        num_e -= 1
    ans = min(ans, num_w + num_e)
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N = int(input())
P = [int(input()) for _ in range(N)]
Q = [P.index(i) for i in range(1, N + 1)]

candidate = []
num = 0
for i in range(N-2):
    num += 1
    if Q[i] > Q[i+1]:
        candidate.append(num)
        num = 0
    if i == N-2:
        candidate.append(num)
print(N - max(candidate))

Fixed submission:
N = int(input())
Q = [0]*N
for i in range(N):
        Q[int(input())-1] = i

subset_num = num = 0
for i in range(N-1):
    num += 1
    if Q[i] > Q[i+1]:
        subset_num = max(subset_num, num)
        num = 0
else:
    num += 1   # 最後だけ数えられないので注意
    subset_num = max(subset_num, num)
print(N - subset_num)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def is_sosu(x):
    for i in range(2, x):
        if x % i == 0:
            return False
    return True

N = int(input())
sosu = []
for candidate in range(2, 55555):
    if is_sosu(candidate) and candidate % 5 == 1:
        sosu.append(candidate)
        if len(sosu) >= N:
            break
print(' '.join([str(s) for s in sosu]))

Fixed submission:
# -*- coding: utf-8 -*-

a, b = map(int, input().split())

if a <= b:
    print(a)
else:
    print(a - 1)

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


def is_sosu(x):
    for i in range(2, x):
        if x % i == 0:
            return False
    return True


def is_gosei(x):
    for i in range(2, x):
        if x % i == 0:
            return True
    return False


def check(lis):
    for i in range(len(lis)):
        for j in range(i, len(lis)):
            for k in range(j, len(lis)):
                for l in range(k, len(lis)):
                    for m in range(l, len(lis)):
                        if is_gosei(lis[i] + lis[j] + lis[k] + lis[l] + lis[m]):
                            pass
                        else:
                            return False
    return True

N = int(input())
sosu = []
for candidate in range(2, 1000):
    if is_sosu(candidate):
        sosu.append(candidate)

for n in range(0, len(sosu)-N, N):
    if check(sosu[n:n + N]):
        print(' '.join([str(s) for s in sosu[n:n + N]]))
        break


Fixed submission:
# -*- coding: utf-8 -*-

a, b = map(int, input().split())

if a <= b:
    print(a)
else:
    print(a - 1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))

x_sort = sorted(X)
m = N/2 - 1
for i in range(N):
    if X[i] <= x_sort[m]:
        print(x_sort[m + 1])
    else:
        print(x_sort[m])

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

x_sort = sorted(X)
m = N//2 - 1
for i in range(N):
    if X[i] <= x_sort[m]:
        print(x_sort[m + 1])
    else:
        print(x_sort[m])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))

for i in range(N):
    x = X[:]
    x.pop(i)
    x.sort()
    print(x[(N-1)//2])

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

x_sort = sorted(X)
m = N//2 - 1
for i in range(N):
    if X[i] <= x_sort[m]:
        print(x_sort[m + 1])
    else:
        print(x_sort[m])
Buggy python submission (verdict: Time Limit Exceeded):
import scipy.misc as scm

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

now = 0
ans = [0] * 2
for i in range(n):
    for j in range(i + 1, n):
        new = scm.comb(a[j], a[i])
        if new > now:
            ans[0] = a[i]
            ans[1] = a[j]
            now = new
print(ans[1], ans[0])

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

a.sort()
a_max = a.pop(-1)
r = 0
for i in range(n-1):
    if abs((a_max/2) - a[i]) < abs((a_max/2) - r):
        r = a[i]
print(a_max, r)