Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03470 (python)

Fixed submission:
n = int(input())
print(len(set(list(map(int, [input() for i in range(n)])))))

Buggy submission (verdict: Runtime Error):
n = input()
print(len(set(list(map(int, [input() for i in range(n)])))))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(len(set(list(map(int, [input() for i in range(n+1)])))))

Buggy submission (verdict: Runtime Error):
n = input()
print(len(set(list(map(int, [input() for i in range(n+1)])))))
Problem p03471 (python)

Fixed submission:
n, y = map(int, input().split())
ans = 0
for i in range(n+1):
    for j in range(n+1-i):
        if y == 10000*i + 5000*j + 1000*(n-i-j):
            print(i, j, n-i-j)
            ans += 1
            exit()
if ans == 0:
    print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
n, y = map(int, input().split())
ans = 0
for i in range(n+1):
    for j in range(n+1-i):
        for k in range(n+1-i-j):
            if y == 10000*i + 5000*j + 1000*k:
                print(i j k)
                ans += 1
if ans == 0:
    print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
n. y = map(int, input().split())
ans = 0
for i in range(n+1):
    for j in range(n+1-i):
        for k in range(n+1-i-j):
            if y == 10000*i + 5000*j + 1000*k:
                print(i j k)
                ans += 1
if ans == 0:
    print("-1 -1 -1")
Problem p03479 (python)

Fixed submission:
X,Y=map(int,input().split())
count=1
while True:
    X*=2
    if X>Y: break
    else: count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import math
x, y = map(int, input().split())
print(round(log2(float(y/x))))

Buggy submission (verdict: Runtime Error):
import math
x, y = map(int, input().split())
print(round(log2(y/x)))
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i) - bin(i).rfind("1") - 1)
print(round(ans))
Problem p03494 (python)

Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy submission (verdict: Runtime Error):
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i) - bin(i).rfind("1") - 1)
print(round(ans))
Problem p03149 (python)

Fixed submission:
str_input_list = input().rstrip().split(' ')
int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))
    
keyence_list = [1, 9, 7, 4]

for a in range(4):
    if keyence_list[a] in int_input_list:
        keyence_list[a] = '*'

if keyence_list == ['*', '*', '*', '*']:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
str_input_list = input().rstrip().split(' ')
int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))
    
keyence_list = [1, 9, 7, 4]

for a in range(4):
    if keyence_list[a] in int_input_list:
        keyence_list.remove(keyence_list[a])
        int_input_list.remove(keyence_list[a])

if keyence_list == []:
    print('YES')
else:
    print('NO')
Problem p04032 (python)

Fixed submission:
s = input()

checker = ''

if len(s) == 2:
    if s[0] == s[1]:
        print(1, 2)
        checker += '*'
    else:
        print(-1, -1)
        checker += '*'


if checker == '':
    for a, b in zip(range(len(s)-1), range(1,len(s))):
        if s[a] == s[b]:
            print(a+1, b+1)
            checker += '*'
            break

if checker == '':
    for a, c in zip(range(len(s)-2), range(2, len(s))):
        if s[a] == s[c]:
            print(a+1, c+1)
            checker += '*'
            break

if checker == '':
    print(-1, -1)

Buggy submission (verdict: Runtime Error):
s = input()

checker = ''

if len(s) == 2:
    if s[0] == s[1]:
        print(1, 2)
        checker += '*'
    else:
        print(-1, -1)
        checker += '*'


if checker == '':
    for a, b in zip(range(len(s)-1), range(1,len(s))):
        if s[a] == s[b]:
            print(a+1, b+1)
            checker += '*'
            break

if checker == '':
    for a, c in zip(range(len(s)-2), range(2, len(s))):
        if s[a] == s[c]:
            print(a+1, c+1)
            chekcher += '*'
            break

if checker == '':
    print(-1, -1)

Buggy submission (verdict: Runtime Error):
s = input()

checker = ''

if len(s) == 2:
    if s[0] == s[1]:
        print(1, 2)
        checker += '*'
    else:
        print(-1, -1)
        checker += '*'


if checker == '':
    for a, b in zip(range(len(s)-1), range(1,len(s))):
        if s[a] == s[b]:
            print(a+1, b+1)
            checker += '*'
            break

if checker == '':
    for a, c in zip(list(range(len(s)-2)), list(range(2, len(s)))):
        if s[a] == s[c]:
            print(a+1, c+1)
            chekcher += '*'
            break

if checker == '':
    print(-1, -1)

Buggy submission (verdict: Runtime Error):
s = input()

checker = ''

if len(s) <= 2:
    if s[0] == s[1]:
        print(1, 2)
        checker += '*'
    else:
        print(-1, -1)
        checker += '*'


if checker == ''
    for a, b in zip(range(len(s)-1), range(1,len(s))):
        if s[a] == s[b]:
            print(a+1, b+1)
            checker += '*'
            break

if checker == '':
    for a, c in zip(list(range(len(s)-2)), list(range(2, len(s)))):
        if s[a] == s[c]:
            print(a+1, c+1)
            chekcher += '*'
            break

if checker == '':
    print(-1, -1)

Buggy submission (verdict: Runtime Error):
s = input()

checker = ''

for a, b in zip(list(range(len(s)-1)), list(range(1,len(s)))):
    if s[a] == s[b]:
        print(a+1, b+1)
        checker += '*'
        break

if checker == '':
    for a, c in zip(list(range(len(s)-2)), list(range(2, len(s)))):
        if s[a] == s[c]:
            print(a+1, c+1)
            chekcher += '*'
            break

if checker == '':
    print(-1, -1)
Problem p04043 (python)

Fixed submission:
haiku_list = ['5', '7', '5']

str_input_list = input().rstrip().split(' ')

for a in range(3):
    if haiku_list[a] in str_input_list:
        str_input_list.remove(haiku_list[a])
        haiku_list[a] = '*'

if haiku_list == ['*', '*', '*']:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
amount, length = map(int, input().split())
S = sorted([input() for a in range(amount)])
print(''.join(S))

Buggy submission (verdict: Runtime Error):
#最初に入力される情報を整理する
str_input_list = input().rstrip().split(' ')

int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))

length = int_input_list[0]
amount = int_input_list[1]

#文字列を受け取りリストに格納
mojiretu_list = []
for a in range(amount):
    mojiretu_list.append(input())


#文字列を小さい順に並べ、結合
sorted_list = sorted(mojiretu_list)
min_mojiretu = ''
for a in range(amount):
    min_mojiretu += sorted_list[a]

#出力
print(min_mojiretu)
print()
Problem p04044 (python)

Fixed submission:
amount, length = map(int, input().split())
S = sorted([input() for a in range(amount)])
print(''.join(S))

Buggy submission (verdict: Runtime Error):
#最初に入力される情報を整理する
str_input_list = input().rstrip().split(' ')

int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))

length = int_input_list[0]
amount = int_input_list[1]

#文字列を受け取りリストに格納
mojiretu_list = []
for a in range(amount):
    mojiretu_list.append(input())


#文字列を小さい順に並べ、結合
sorted_list = sorted(mojiretu_list)
min_mojiretu = ''
for a in range(amount):
    min_mojiretu += sorted_list[a]

#出力
print(min_mojiretu)

Buggy submission (verdict: Runtime Error):
#最初に入力される情報を整理する
str_input_list = input().rstrip().split(' ')

int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))

length = int_input_list[0]
amount = int_input_list[1]

#文字列を受け取りリストに格納
mojiretu_list = []
for a in range(amount):
    mojiretu_list.append(input())

#文字列を小さい順に並べ、結合
sorted_list = sorted(mojiretu_list)
min_mojiretu = ''
for a in range(amount):
    min_mojiretu += sorted_list[a]

#出力
print(min_mojiretu)
Problem p03150 (python)

Fixed submission:
S=input()
N=len(S)
for i in range(0,N+1):
    for j in range(i,N+1):
        if  S[:i] + S[j:] == 'keyence':
            print("YES")
            exit(0)
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
S=input()
N=len(S)
for i in range(0,N+1):
    for j in range(i,N+1):
        if "".join(S[:i] + S[j:]) == 'keyence':
            print("YES")
            exit(1)
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
S=list('keyekeyencence')
N=len(S)
for i in range(0,N+1):
    for j in range(i,N+1):
        if "".join(S[:i] + S[j:]) == 'keyence':
            print("YES")
            exit(1)
else:
    print('NO')
Problem p03149 (python)

Fixed submission:
f = []
f = input().split()
if '1' in f:
     if '9' in f:
          if '7' in f:
               if '4' in f:
                    print("YES")
               else:
                    print("NO")
          else:
               print("NO")
     else:
          print("NO")
else:
     print("NO")

Buggy submission (verdict: Runtime Error):
f = []
f = input().split()
if '1' in f:
if '9' in f:
if '7' in f:
if '4' in f:
print("YES")
else:
print("NO")
else:
print("NO")
else:
print("NO")
else:
print("NO")

Buggy submission (verdict: Runtime Error):
f = []
f = input().split()

if '1' in f:
     if '9' in f:
          if '7' in f:
               if '4' in f:
                    print("YES")
               else:
                    print("NO")
           else:
                print("NO")
     else:
          print("NO")
else:
     print("NO")
Problem p03219 (python)

Fixed submission:
fare = input().split()
print(int(int(fare[0])+int(fare[1])/2))

Buggy submission (verdict: Runtime Error):
n=input()
t,a=input().split()
b=input().split()
n=int(n)
t=int(t)
a=int(a)
min=1000
for i in range(n):
     diff=abs(a-t+0.006*int(b[i]))
     if min>diff:
          id=i+1
          min=diff
print(id)
Problem p03220 (python)

Fixed submission:
n=input()
t,a=input().split()
n=int(n)
t=int(t)
a=int(a)
b=input().split()
min=1000
for i in range(n):
    diff=abs(a-t+0.006*int(b[i]))
    if min>diff:
        id=i+1
        min=diff

print (id)

Buggy submission (verdict: Runtime Error):
n=input()
t,a=input().split()
h=[]
n=int(n)
t=int(t)
a=int(a)
b=input().split()
min=1000
for i in range(n):
     b[i]=int(b[i])
     if min > abs(a-t+0.006*b[i]):
          min=abs(a-t+0.006*b[i]))
          id=i+1
print(id)
Problem p03149 (python)

Fixed submission:
from sets import Set

l = map(int, raw_input().split())
s = Set(l)
r_s = Set([1, 9, 7, 4])
if s == r_s:
	print 'YES'
else:
	print 'NO'

Buggy submission (verdict: Runtime Error):
s = set(*args)
r_s = set([1, 9, 4, 7])
if s == r_s:
 print(YES)
else:
 print(NO)
Problem p03149 (python)

Fixed submission:
li = list(map(int, input().split()))
if (1 in li) and (9 in li) and (7 in li) and (4 in li):
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
li = list(map(int, input().split()))
if (li in 1) and (li in 9) and (li in 7) and (li in 4):
  print('YES')
else:
  print('NO')
Problem p03150 (python)

Fixed submission:

def solve(s):
  t = 'keyence'
  if t in s[0:7] or t in s[-7:]:
    return 'YES'

  p = 0
  for i in range(len(s)):
    if t[p] == s[i]:
      p = p + 1
    else:
      if t[p:] in s[-7+p:]:
        return 'YES'
      else:
        return 'NO'
  return 'NO'

print(solve(input()))

Buggy submission (verdict: Runtime Error):
s = input()
t = 'keyence'
cnt = 0
j = False
p = 0
for i in range(len(s)):
  if t[p] == s[i]:
    if j == True:
      j = False
      cnt = cnt + 1
    p = p + 1
  else:
    j = True
print('YES' if p == len(t) and cnt <= 1 else 'N0')
Problem p03150 (python)

Fixed submission:
l = raw_input()
flag = False
if len(l) >= 6:
    for i in range(7):
        tmp = l[0:i] + l[-7+i:]
        if tmp == "keyence":
            flag = True
if flag == True:
    print "YES"
else:
    print "NO"

Buggy submission (verdict: Runtime Error):
File Edit Options Buffers Tools YASnippet Complete In/Out Signals Help                                                                     
l = raw_input()
flag = False
if len(l) == 7:
    if l == "keyence":
        flag = True
elif len(l) == 8:
    for i in range(8):
        tmp = l[:i] + l[i+1:]
        if tmp == "keyence":
            flag = True
else:
    flag = False
if flag == True:
    print "YES"
else:
    print "NO"
Problem p03150 (python)

Fixed submission:
def main(pro):
    ans = 'keyence'
    try:
        lokasi = pro.index(ans)
        if lokasi > 0 and lokasi + len(ans) < len(pro):
            raise ValueError()
        else:
            print('YES')
            return
    except:
        for i in range(len(ans)):
            if ans[i] != pro[i]:
                break
        r = len(ans) - i
        for a in range(1,r+1):
            if ans[-r] != pro[-r]:
                print('NO')
                return
        print('YES')

main(input())

Buggy submission (verdict: Runtime Error):
def main(pro):
    ans = 'keyence'
    try:
        lokasi = pro.index(ans)
        if lokasi > 0 and lokasi + len(ans) < len(pro):
            raise ValueError()
            return
        else:
            print('YES')
            return
    except:
        # it is split
        for i in range(len(ans)):
            if ans[i] != pro[i]:
                break
        r = len(ans) - i
        for a in range(1,r+1):
            if ans[-r] != pro[-r]:
                print('NO')
                return
        print('YES')
while True:
    main(input())
Problem p03455 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a, b = map(int, raw_input().split())

if a * b % 2 == 0:
    print "Even"
else:
    print "Odd"

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
N = input()
t, x, y = [0], [0], [0]
for _ in range(N):
    _t, _x, _y = map(float, raw_input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

# /w1 = w[0]


txy = np.array([[_t, _x, _y] for _t, _x, _y in zip(t, x, y)], dtype=np.int32)

dm = np.diff(txy, axis=0)
for d in dm:
    total = np.abs(d[1]) + np.abs(d[2])
    if d[0] >= total  and (d[0] - total) % 2 == 0:
        print 'Yes'
        exit()

print 'No'

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b = map(int, raw_input().split())

if a * b % 2 == 0:
    print "Even"
else:
    print "Odd"
Problem p03456 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np

a, b = map(str, raw_input().split())
i = int(a + b)

if i == int(np.sqrt(i)) ** 2:
    print "Yes"
else:
    print "No"

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

a, b = map(str, raw_input().split())
i = int(a + b)

if i == int(np.sqrt(i)) ** 2:
    print "Yes"
else:
    print "No"
Problem p03719 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a, b, c = map(int, raw_input().split())

if a <= c <= b:
    print "Yes"
else:
    print "No"

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

# def flatten(nested_list):
#     return [e for inner_list in nested_list for e in inner_list]

N, K = map(int, raw_input().split())

a = [0] * N
b = [0] * N
ab = [[0, 0]] * N
for i in range(N):
    _a, _b = map(int, raw_input().split())
    ab[i] = [_a, _b]
ab.sort(key=lambda x:x[0])

j = 0
index = 0
while j < K:
    j += ab[index][1]
    if j < K:
        index += 1
print ab[index][0]
Problem p03324 (python)

Fixed submission:
D, N = map(int, input().split())
if N == 100: print(100**D*101)
else: print(100**D*N)

Buggy submission (verdict: Runtime Error):
D, N = map(int, input())
if D == 2 and N == 100: print(1010000)
else: print(100**D*N)
Problem p03283 (python)

Fixed submission:
import numpy as np

n, m, q = map(int, input().split())

mat = np.zeros((n, n), dtype=int)

for i in range(m):
    l, r = map(int, input().split())
    mat[l-1, r-1] += 1
mat = np.flipud(mat)
matmul = np.cumsum(mat, axis=0)
matmul = np.flipud(matmul)
matmul2 = np.cumsum(matmul, axis=1)

for i in range(q):
    p, q = map(int, input().split())
    ans = matmul2[p-1, q-1]
    print(ans)

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

n, m, q = map(int, input().split())

mat = np.zeros((n, n), dtype=np.uint32)

for i in range(m):
    l, r = map(int, input().split())
    mat[l-1, r-1] += 1
mat = np.flipud(mat)
matmul = np.cumsum(mat, axis=0)
matmul = np.flipd[matmul]
matmul2 = np.cumsum(matmul, axis=1)

for i in range(q):
    p, q = map(int, input().split())
    ans = matmul2[p-1, q-1]
    print(ans)
Problem p03303 (python)

Fixed submission:
S = list(input())
w = int(input())
li = [S[w*i] for i in range((len(S)-1)//w + 1)]
result = ''.join(li)

print(result)

Buggy submission (verdict: Runtime Error):
S = list(input())
w = int(input())
li = [S[w*i] for i in range(len(S)//w + 1)]
result = ''.join(li)

print(result)
Problem p03309 (python)

Fixed submission:
from statistics import *



n = int(input())
list = input().split()

for i in range(n):
    list[i] = int(list[i]) - (i + 1)

b = int(median(list))

for i in range(n):
    list[i] = abs(list[i] - b)

print(sum(list))

Buggy submission (verdict: Runtime Error):
n = int(input())
list = input().split()

for i in range(n):
    list[i] = int(list[i]) - (i + 1)

b = int(median(list))

for i in range(n):
    list[i] = abs(list[i] - b)

print(sum(list))
Problem p03260 (python)

Fixed submission:
'''input
2 2
'''
from sys import exit
a,b = map(int,raw_input().split())
for i in range(1,4):
	if a*b*i&1:
		print "Yes"
		exit(0)
print "No"

Buggy submission (verdict: Runtime Error):
'''input
3 5
1 2 3
'''
from fractions import gcd
n,x = map(int,raw_input().split())
arr = map(int,raw_input().split())
arr.append(x)
arr.sort()
diff = []
for i in range(1,n):
	diff.append(arr[i]-arr[i-1])
gc = diff[0]
for i in range(1,len(diff)):
	gc = gcd(gc,diff[i])
print gc
Problem p03262 (python)

Fixed submission:
'''input
2 1
555 556
'''
from fractions import gcd
n,x = map(int,raw_input().split())
arr = map(int,raw_input().split())
arr.append(x)
arr.sort()
diff = []
for i in range(1,n+1):
	diff.append(arr[i]-arr[i-1])
gc = diff[0]
for i in range(1,len(diff)):
	gc = gcd(gc,diff[i])
print gc

Buggy submission (verdict: Runtime Error):
'''input
3 5
1 2 3
'''
from fractions import gcd
n,x = map(int,raw_input().split())
arr = map(int,raw_input().split())
arr.append(x)
arr.sort()
diff = []
for i in range(1,n):
	diff.append(arr[i]-arr[i-1])
gc = diff[0]
for i in range(1,len(diff)):
	gc = gcd(gc,diff[i])
print gc

Buggy submission (verdict: Runtime Error):
'''input
3 81
33 105 57
'''
from fractions import gcd
n,x = map(int,raw_input().split())
arr = map(int,raw_input().split())
arr.append(x)
arr.sort()
diff = []
for i in range(1,n):
	diff.append(arr[i]-arr[i-1])
gc = diff[0]
for i in range(1,len(diff)):
	gc = gcd(gc,diff[i])
print gc
Problem p03292 (python)

Fixed submission:
arr = map(int,raw_input().split())
arr.sort()
cost = arr[1]-arr[0] + arr[2]-arr[1]
print cost

Buggy submission (verdict: Runtime Error):
n = input()
arr = map(int,raw_input().split())
print sum(arr)-n
Problem p03311 (python)

Fixed submission:
'''input
7
1 1 1 1 2 3 4
'''
n = input()
arr = map(int,raw_input().split())
for i in range(n):
	arr[i] = (arr[i]-(i+1))
arr.sort()
mean = float(arr[n//2])
ans = 10**30
for i in range(int(mean)-30,int(mean)+30):
	q = 0
	for j in range(n):
		q += abs(arr[j]-i)
	ans = min(q,ans)
print ans

Buggy submission (verdict: Runtime Error):
'''input
7
1 1 1 1 2 3 4
'''
n = input()
arr = map(int,raw_input().split())
for i in range(n):
	arr[i] = (arr[i]-(i+1))
arr.sort()
mean = float(arr[n//2]+arr[n//2+1])/2
ans = 10**30
for i in range(int(mean)-30,int(mean)+30):
	q = 0
	for j in range(n):
		q += abs(arr[j]-i)
	ans = min(q,ans)
print ans

Buggy submission (verdict: Runtime Error):
'''input
7
1 1 1 1 2 3 4
'''
n = input()
arr = map(int,raw_input().split())
for i in range(n):
	arr[i] = (arr[i]-(i+1))
arr.sort()
mean = float(arr[n//2]+arr[n//2+1])/n
ans = 10**30
for i in range(int(mean)-30,int(mean)+30):
	q = 0
	for j in range(n):
		q += abs(arr[j]-i)
	ans = min(q,ans)
print ans

Buggy submission (verdict: Runtime Error):
'''input
7
1 1 1 1 2 3 4
'''
n = input()
arr = map(int,raw_input().split())
for i in range(n):
	arr[i] = (arr[i]-(i+1))
arr.sort()
median = float(arr[n//2]+arr[n//2+1])/n
ans = 10**30
for i in range(int(mean)-30,int(mean)+30):
	q = 0
	for j in range(n):
		q += abs(arr[j]-i)
	ans = min(q,ans)
print ans
Problem p03323 (python)

Fixed submission:
'''input
4 5
'''
a,b = map(int,raw_input().split())
if a > 8 or b > 8 :
	print ":("
else:
	print "Yay!"

Buggy submission (verdict: Runtime Error):
'''input
3 14 3 25
3 1 1
'''
a = input()
b = input()
if a > 8 or b > 8 :
	print ":("
else:
	print "Yay!"
Problem p03552 (python)

Fixed submission:
'''input
4
4 3 2 1
'''
n,z,w = map(int,raw_input().split())
arr = map(int,raw_input().split())
if n > 1:
	print max(abs(arr[-1]-w),abs(arr[-1]-arr[-2]))
else:
	print abs(arr[-1]-w)

Buggy submission (verdict: Runtime Error):
n,z,w = map(int,raw_input().split())
arr = map(int,raw_input().split())
print max(abs(arr[-1]-w),abs(arr[-1]-arr[-2]))
Problem p03627 (python)

Fixed submission:
'''input
4
1 2 3 4
'''
from collections import Counter
n = input()
arr = map(int,raw_input().split())
c = Counter(arr)
li = []
for i in c:
	if c[i] >= 2:
		li.append(i)
li.sort()
if len(li) == 0:
	print "0"
elif len(li) == 1:
	print li[-1]**2
else:
	if c[li[-1]] >= 4:
		print li[-1]**2
	else:
		print li[-1]*li[-2]

Buggy submission (verdict: Runtime Error):
'''input
2 2
3
2 1 1
'''
from collections import Counter
n = input()
arr = map(int,raw_input().split())
c = Counter(arr)
li = []
for i in c:
	if c[i] >= 2:
		li.append(i)
li.sort()
if li == 1:
	print li[-1]**2
else:
	if c[li[-1]] >= 4:
		print li[-1]**2
	else:
		print li[-1]*li[-2]

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = input()
arr = map(int,raw_input().split())
c = Counter(arr)
li = []
for i in c:
	if c[i] >= 2:
		li.append(i)
li.sort()
print li[-1]*li[-2]
Problem p03848 (python)

Fixed submission:
import sys
from collections import Counter
n = input()
a = [int(x) for x in raw_input().split()]
a.sort()
if n == 1:
    if a[0] == 0:
        print 1
        sys.exit()
c = 0
if n&1:
    if a[0] == 0:
        del a[0]
        d = Counter(a)
        for i in d.keys():
            if i == 0:
                print 0
                sys.exit()
            if i&1:
                print 0
                sys.exit()
            if not(i&1):
                if d[i] == 2:
                    c += 1
                if d[i] != 2:
                    print 0
                    sys.exit()
    if c == (n-1)//2:
        print (1 << c)%(10**9+7)
if not(n&1):
    d = Counter(a)
    for i in d.keys():
        if i&1:
            if d[i] == 2:
                c +=1
            if d[i] != 2:
                print 0
                sys.exit()
        if not(i&1):
            print 0
            sys.exit()
    if c == n//2:
        print (1 << c)%(10**9+7)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = input()
a = [int(x) for x in raw_input().split()]
a.sort()
c = 0
if n&1:
    if a[0] == 0:
        del a[0]
        d = Counter(a)
        for i in d.keys():
            if i == 0:
                print 0
                exit(1)
            if i&1:
                print 0
                exit(1)
            if not(i&1):
                if d[i] == 2:
                    c += 1
                if d[i] != 2:
                    print 0
                    exit(1)
    if c == (n-1)//2:
        print (1 << c)%(10**9+7)
if not(n&1):
    d = Counter(a)
    for i in d.keys():
        if i&1:
            if d[i] == 2:
                c +=1
            if d[i] != 2:
                print 0
                exit(1)
        if not(i&1):
            print 0
            exit(1)
    if c == n//2:
        print (1 << c)%(10**9+7)