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

def get_nearest_val(l, n, side='left'):
    l = sorted(l)
    i = np.searchsorted(l, n, side=side)
    return l[i]

def comb(n, r):
    if n < 0 or r < 0 or n < r: return 0
    elif n == 0 or r == 0: return 1
    return comb(n-1, r-1) + comb(n-1, r)

n = int(input())
A = list(map(int, input().split(' ')))

max_n = max(A)
key_r = (max_n + 1) / 2
# key_r = int((max_n + 1) / 2)
# print(key_r)

left_r = get_nearest_val(A, key_r, side='left')
# print(left_r)
right_r = get_nearest_val(A, key_r, side='right')
# print(right_r)

left_comb = comb(max_n, left_r)
# print(left_comb)
right_comb = comb(max_n, right_r)
# print(right_comb)

if left_comb >= right_comb:
    print(str(max_n) + ' ' + str(left_r))
else:
    print(str(max_n) + ' ' + str(right_r))

Fixed submission:

import numpy as np
import math

def get_nearest_val(l, n):
    i = np.abs(np.asarray(l) - n).argmin()
    return l[i]

n = int(input())
A = list(map(int, input().split(' ')))

max_n = max(A)
A = sorted(A)
max_n = A[-1]
# A = A.pop
A.pop(-1)
key_r = (max_n + 1) / 2
# key_r = int((max_n + 1) / 2)
# print(key_r)

# left_r = get_nearest_val(A, key_r, side='left')
# # print(left_r)
# right_r = get_nearest_val(A, key_r, side='right')
# # print(right_r)

# left_comb = comb(max_n, left_r)
# # print(left_comb)
# right_comb = comb(max_n, right_r)
# # print(right_comb)

# if left_comb >= right_comb:
#     print(str(max_n) + ' ' + str(left_r))
# else:
#     print(str(max_n) + ' ' + str(right_r))

r = get_nearest_val(A, key_r)
# r = get_nearest_val(A[:len(A)-1], key_r)
print(str(max_n) + ' ' + str(r))

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

def get_nearest_val(l, n, side='left'):
    l = sorted(l)
    i = np.searchsorted(l, n, side=side)
    return l[i]

def comb(n, r):
    if n < 0 or r < 0 or n < r: return 0
    elif n == 0 or r == 0: return 1
    return comb(n-1, r-1) + comb(n-1, r)

n = int(input())
A = list(map(int, input().split(' ')))

max_n = max(A)

key_r = int((max_n + 1) / 2)

left_r = get_nearest_val(A, key_r, side='left')
right_r = get_nearest_val(A, key_r, side='right')

left_comb = comb(max_n, left_r)
right_comb = comb(max_n, right_r)

if left_comb >= right_comb:
    print(str(max_n) + ' ' + str(left_r))
else:
    print(str(max_n) + ' ' + str(right_r))

Fixed submission:

import numpy as np
import math

def get_nearest_val(l, n):
    i = np.abs(np.asarray(l) - n).argmin()
    return l[i]

n = int(input())
A = list(map(int, input().split(' ')))

max_n = max(A)
A = sorted(A)
max_n = A[-1]
# A = A.pop
A.pop(-1)
key_r = (max_n + 1) / 2
# key_r = int((max_n + 1) / 2)
# print(key_r)

# left_r = get_nearest_val(A, key_r, side='left')
# # print(left_r)
# right_r = get_nearest_val(A, key_r, side='right')
# # print(right_r)

# left_comb = comb(max_n, left_r)
# # print(left_comb)
# right_comb = comb(max_n, right_r)
# # print(right_comb)

# if left_comb >= right_comb:
#     print(str(max_n) + ' ' + str(left_r))
# else:
#     print(str(max_n) + ' ' + str(right_r))

r = get_nearest_val(A, key_r)
# r = get_nearest_val(A[:len(A)-1], key_r)
print(str(max_n) + ' ' + str(r))

Buggy python submission (verdict: Runtime Error):
'''
thinking
comb(n, r)
'''
import numpy as np
import itertools

def get_nearest_val(l, n, side='left'):
    l = sorted(l)
    i = np.searchsorted(l, n, side=side)
    return l[i]

# c = list(itertools.combinations(s,3))

def comb(n, r):
    if n < 0 or r < 0 or n < r: return 0
    elif n == 0 or r == 0: return 1
    return comb(n-1, r-1) + comb(n-1, r)


# def get_nearest_val(l, n):
#     i = np.abs(np.asarray(l) - n).argmin()
#     return l[i]

n = int(input())
A = list(map(int, input().split(' ')))

# n = 5
# A = [6, 9, 4, 2, 11]

max_n = max(A)

key_r = (max_n + 1) / 2

left_r = get_nearest_val(A, key_r, side='left')
right_r = get_nearest_val(A, key_r, side='right')

left_comb = comb(max_n, left_r)
right_comb = comb(max_n, right_r)

# left_comb = len(list(itertools.combinations(A, left_r)))
# right_comb = len(list(itertools.combinations(A, right_r)))

if left_comb >= right_comb:
    print(str(max_n) + ' ' + str(left_r))
else:
    print(str(max_n) + ' ' + str(right_r))

Fixed submission:

import numpy as np
import math

def get_nearest_val(l, n):
    i = np.abs(np.asarray(l) - n).argmin()
    return l[i]

n = int(input())
A = list(map(int, input().split(' ')))

max_n = max(A)
A = sorted(A)
max_n = A[-1]
# A = A.pop
A.pop(-1)
key_r = (max_n + 1) / 2
# key_r = int((max_n + 1) / 2)
# print(key_r)

# left_r = get_nearest_val(A, key_r, side='left')
# # print(left_r)
# right_r = get_nearest_val(A, key_r, side='right')
# # print(right_r)

# left_comb = comb(max_n, left_r)
# # print(left_comb)
# right_comb = comb(max_n, right_r)
# # print(right_comb)

# if left_comb >= right_comb:
#     print(str(max_n) + ' ' + str(left_r))
# else:
#     print(str(max_n) + ' ' + str(right_r))

r = get_nearest_val(A, key_r)
# r = get_nearest_val(A[:len(A)-1], key_r)
print(str(max_n) + ' ' + str(r))