Buggy python submission (verdict: Time Limit Exceeded):
import math
def c(n,r):
    r=min(r,n-r)
    a=math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
    return a
q=1    
N=int(input())
s=list(map(int,input().split()))
n=max(s)
for i in s:
    t=c(n,i)
    if q<=t:
        q=t
        w=str(n)+" "+str(i)
print(w)        
    

Fixed submission:
N=int(input())
s=list(map(int,input().split()))
n=max(s)
s.remove(n)
q=n
for i in s:
    t=abs(n/2-i)
    if q>=t:
        q=t
        w=str(n)+" "+str(i)
print(w)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# hello worldと表示する
# coding: utf-8
# hello worldと表示する
# coding: utf-8
# hello worldと表示する
"""def comb2(n,r):
    if n == 0 or r == 0: 
        return 1
    return comb2(n-1,r-1)+comb2(n-1,r)
def fact(n):
    if n==0:
        return 1
    return n*fact(n-1)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]"""
def ncr(n, r):
    r = min(r, n - r)
    if r == 0: return 1;
    if r == 1: return n;
    numerator = [n - r + i + 1 for i in range(r)]
    denominator  = [i + 1 for i in range(r)]
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1: 
            result *= numerator[k]
    return result
#a = cmb(n,r)
ans=0    
N=int(input())
s=list(map(int,input().split()))
t=max(s)
for i in s:
    c=ncr(t,i)
#    c=fact(t)/(fact(i)*fact(t-i))
    if ans<c and t!=i:
        ans=c
        an=i
print(str(t)+" "+str(an))        


Fixed submission:
N=int(input())
s=list(map(int,input().split()))
n=max(s)
s.remove(n)
q=n
for i in s:
    t=abs(n/2-i)
    if q>=t:
        q=t
        w=str(n)+" "+str(i)
print(w)

Buggy python submission (verdict: Runtime Error):
def fact(n):
    if n==0:
        return 1
    return n*fact(n-1)
ans=0    
N=int(input())
s=list(map(int,input().split()))
t=max(s)
for i in s:
    c=fact(t)/(fact(i)*fact(t-i))
    if ans<c and t!=i:
        ans=c
        an=i
print(str(t)+" "+str(an))        


Fixed submission:
N=int(input())
s=list(map(int,input().split()))
n=max(s)
s.remove(n)
q=n
for i in s:
    t=abs(n/2-i)
    if q>=t:
        q=t
        w=str(n)+" "+str(i)
print(w)

Buggy python submission (verdict: Runtime Error):
def fact(n):
    if n==0:
        return 1
    return n*fact(n-1)
ans=0    
N=int(input())
s=list(map(int,input().split()))
t=max(s)
for i in s:
    c=fact(t)/(fact(i)*fact(t-i))
    if ans<c and c!=i:
        ans=c
        an=i
print(str(t)+" "+str(an))        
print(fact(0))

Fixed submission:
N=int(input())
s=list(map(int,input().split()))
n=max(s)
s.remove(n)
q=n
for i in s:
    t=abs(n/2-i)
    if q>=t:
        q=t
        w=str(n)+" "+str(i)
print(w)

Buggy python submission (verdict: Runtime Error):
def fact(n):
    if n==0:
        return 1
    return n*fact(n-1)
ans=0    
N=int(input())
s=list(map(int,input().split()))
t=max(s)
for i in s:
    c=fact(t)/(fact(i)*fact(t-i))
    if ans<c:
        ans=c
        an=i
print(str(t)+" "+str(an))        
    

Fixed submission:
N=int(input())
s=list(map(int,input().split()))
n=max(s)
s.remove(n)
q=n
for i in s:
    t=abs(n/2-i)
    if q>=t:
        q=t
        w=str(n)+" "+str(i)
print(w)