Buggy python submission (verdict: Runtime Error):
n=input()
l=[int(x) for x in input().split()]
temp=list(set(x for x in l if l.count(x)>1))
y=max(temp)
if l.count(y)>3:
	lar=sec=y
else:
	lar=y
	temp.remove(y)
	sec=max(temp)
print(lar*sec)


Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
lar=sec=i=0
while(i<n-1):
    if a[i]==a[i+1]:
        i+=1
        if a[i]>lar:
            sec=lar
            lar=a[i]
        elif a[i]>sec:
             sec=a[i]
    i+=1
print(lar*sec)

Buggy python submission (verdict: Time Limit Exceeded):
n=input()
temp=[]
l=[int(x) for x in input().split()]
for x in l:
	if x not in temp:
		y=l.count(x)
		if y>3:
			temp.append(x)
		if(y>1):
			temp.append(x)
	
if len(temp)<2:
	print(0)
else:
	x=max(temp)
	temp.remove(x)
	print(x*max(temp))


Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
lar=sec=i=0
while(i<n-1):
    if a[i]==a[i+1]:
        i+=1
        if a[i]>lar:
            sec=lar
            lar=a[i]
        elif a[i]>sec:
             sec=a[i]
    i+=1
print(lar*sec)

Buggy python submission (verdict: Runtime Error):
n=int(input())
ls=[]
temp=[]
temp= list((for x in input().split()))
temp=list(set([x for x in l if l.count(x)>1]))
for x in l:
	if (l.count(x)>3):
		ls.append(x)
temp+=list(set(ls))
if len(temp)<2:
	print(0)
else:
	x=max(temp)
	temp.remove(x)
	print(x*max(temp))

Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
lar=sec=i=0
while(i<n-1):
    if a[i]==a[i+1]:
        i+=1
        if a[i]>lar:
            sec=lar
            lar=a[i]
        elif a[i]>sec:
             sec=a[i]
    i+=1
print(lar*sec)

Buggy python submission (verdict: Runtime Error):
lst = []
N = int(input("Enter number of elements : "))
for i in range(0,N):
    lst.append(int(input()))
temp = [x for x in lst if lst.count(x)>1]
list_set = set(temp)
dups = (list(list_set))
if (len(dups)<2):
   print('0')
   print('No rectangle can be formed')
else:
    a = dups[0]; b = dups[1]
    n=len(dups)    
    for i in range(0, n):
      for j in range(i + 1, n):
        if (dups[i]*dups[j]>a*b):
             a = dups[i]
             b = dups[j]
    print(a*b)
    print(a,' times ',b,' rectangle can be formed')

Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
lar=sec=i=0
while(i<n-1):
    if a[i]==a[i+1]:
        i+=1
        if a[i]>lar:
            sec=lar
            lar=a[i]
        elif a[i]>sec:
             sec=a[i]
    i+=1
print(lar*sec)

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

arrr = [0]*(max(arr)+2)

for i in arr:
    arrr[i]+=1

s1=0
s2=0

#print(arrr)

for j in range(max(arr),0,-1):
    #print(j)
    if arrr[j]>=2:
        arrr[j]-=2
        s1=j
        break

for j in range(max(arr),0,-1):
    if arrr[j]>=2:
        arrr[j]-=2
        s2=j
        break

print(s1*s2)

Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
lar=sec=i=0
while(i<n-1):
    if a[i]==a[i+1]:
        i+=1
        if a[i]>lar:
            sec=lar
            lar=a[i]
        elif a[i]>sec:
             sec=a[i]
    i+=1
print(lar*sec)

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

arrr = [0]*(max(arr)+2)

for i in arr:
    arrr[i]+=1

s1=0
s2=0

for j in range(max(arrr),0,-1):
    if arrr[j]>=2:
        arrr[j]-=2
        s1=j

for j in range(max(arrr),0,-1):
    if arrr[j]>=2:
        arrr[j]-=2
        s2=j

if s1==0 or s2==0:
    print(0)
else:
    print(s1*s2)

Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
lar=sec=i=0
while(i<n-1):
    if a[i]==a[i+1]:
        i+=1
        if a[i]>lar:
            sec=lar
            lar=a[i]
        elif a[i]>sec:
             sec=a[i]
    i+=1
print(lar*sec)