Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, x, y = map(int, input().split())

ans = [0]*n
for i in range(1, n+1):
  for j in range(i, n+1):
    if i <= j:
      ji = j - i
      xi = i - x
      jy = y - j
      l = [ji,  np.abs(xi) + 1 + np.abs(jy)]
      m = min(l)
      ans[m] += 1
      
print(*ans[1:], sep = '\n')


Fixed submission:
n, x, y = map(int, input().split())

ans = [0]*n
for i in range(1, n+1):
  for j in range(i, n+1):
    m = min(j-i,  abs(x-i) + 1 + abs(j-y))
    ans[m] += 1
      
print(*ans[1:], sep = '\n')

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

n, x, y = map(int, input().split())

ans = []
for i in range(1, n+1):
  for j in range(i, n+1):
    ji = j - i
    xi = x - i
    jy = j - y
    l = [ji,  np.abs(xi) + 1 + np.abs(jy)]
    m = min(l)
    ans.append(m)
      
    
for k in range(n-1):
  print(ans.count(k+1))


Fixed submission:
n, x, y = map(int, input().split())

ans = [0]*n
for i in range(1, n+1):
  for j in range(i, n+1):
    m = min(j-i,  abs(x-i) + 1 + abs(j-y))
    ans[m] += 1
      
print(*ans[1:], sep = '\n')

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

n, x, y = map(int, input().split())

ans = []
for i in range(1, n+1):
  for j in range(i, n+1):
    ji = i - j
    xi = i - x
    jy = y - j
    l = [np.abs(ji),  np.abs(xi) + 1 + np.abs(jy)]
    m = min(l)
    ans.append(m)
      
    
for k in range(n-1):
  print(ans.count(k+1))


Fixed submission:
n, x, y = map(int, input().split())

ans = [0]*n
for i in range(1, n+1):
  for j in range(i, n+1):
    m = min(j-i,  abs(x-i) + 1 + abs(j-y))
    ans[m] += 1
      
print(*ans[1:], sep = '\n')

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

n, x, y = map(int, input().split())

ans = []
for i in range(1, n+1):
  for j in range(i, n+1):
    ji = i - j
    xi = i - x
    jy = y - j
    yi = i - y
    jx = x - j
    l = [np.abs(ji),  np.abs(xi) + 1 + np.abs(jy)]
    m = min(l)
    ans.append(m)
      
    
for k in range(n-1):
  print(ans.count(k+1))


Fixed submission:
n, x, y = map(int, input().split())

ans = [0]*n
for i in range(1, n+1):
  for j in range(i, n+1):
    m = min(j-i,  abs(x-i) + 1 + abs(j-y))
    ans[m] += 1
      
print(*ans[1:], sep = '\n')

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

n, x, y = map(int, input().split())

ans = []
for i in range(1, n+1):
  for j in range(1, n+1):
    if i <= j:
      ji = i - j
      xi = i - x
      jy = y - j
      yi = i - y
      jx = x - j
      l = [np.abs(ji),  np.abs(xi) + 1 + np.abs(jy)]
      m = min(l)
      ans.append(m)
      
    
for k in range(n-1):
  print(ans.count(k+1))


Fixed submission:
n, x, y = map(int, input().split())

ans = [0]*n
for i in range(1, n+1):
  for j in range(i, n+1):
    m = min(j-i,  abs(x-i) + 1 + abs(j-y))
    ans[m] += 1
      
print(*ans[1:], sep = '\n')
Buggy python submission (verdict: Runtime Error):
s = input().split('i')

h = s[:len(s)-1]
space = s[len(s)-1]


for j in h:
  if j =='h' and space == '':
    ans = 'Yes'
  else:
    ans = 'No'
    break
  
print(ans)


Fixed submission:
h = input()

result = 'Yes'

if len(h)%2 != 0:
  result ='No'
  
for a in range(0,len(h)-1,2):  
  b = h[a:a+2]
  if b != 'hi':
    result = 'No'
    break
    
print(result)

Buggy python submission (verdict: Runtime Error):
s = input().split('i')

h = s[:len(s)-1]
space = s[len(s)-1]

for j in h:
  if j =='h' and space == '':
    ans = 'Yes'
  else:
    ans = 'No'
    break
  
print(ans)

Fixed submission:
h = input()

result = 'Yes'

if len(h)%2 != 0:
  result ='No'
  
for a in range(0,len(h)-1,2):  
  b = h[a:a+2]
  if b != 'hi':
    result = 'No'
    break
    
print(result)

Buggy python submission (verdict: Runtime Error):
s = input().split('i')

h = s[:len(s)-1]
space = s[len(s)-1]

for j in h:
  if j =='h' and space == '':
    ans = 'Yes'
  else:
    ans = 'No'
  
print(ans)

Fixed submission:
h = input()

result = 'Yes'

if len(h)%2 != 0:
  result ='No'
  
for a in range(0,len(h)-1,2):  
  b = h[a:a+2]
  if b != 'hi':
    result = 'No'
    break
    
print(result)

Buggy python submission (verdict: Runtime Error):
s = input().split('i')

h = s[:len(s)-1]
i = s[len(s)-1]
ans = 'No'

for j in h:
  if j =='h' and i == '':
    ans = 'Yes'
  
print(ans)

Fixed submission:
h = input()

result = 'Yes'

if len(h)%2 != 0:
  result ='No'
  
for a in range(0,len(h)-1,2):  
  b = h[a:a+2]
  if b != 'hi':
    result = 'No'
    break
    
print(result)

Buggy python submission (verdict: Runtime Error):
s = input().split('i')

h = s[:len(s)-1]
i = s[len(s)-1]
ans = 'No'
for j in h:
  if j =='h' and i == '':
    ans = 'Yes'
  
print(ans)

Fixed submission:
h = input()

result = 'Yes'

if len(h)%2 != 0:
  result ='No'
  
for a in range(0,len(h)-1,2):  
  b = h[a:a+2]
  if b != 'hi':
    result = 'No'
    break
    
print(result)
Buggy python submission (verdict: Runtime Error):
s = list(input().split())

if s[0] == s[1] and s[1] == s[2]:
  print('No')
else:
  print('Yes')

Fixed submission:
s = list(input())

if s[0] == s[1] and s[1] == s[2]:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())


ans = []
for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if s[i] + s[j] + s[k] not in ans:
        ans.append(s[i] + s[j] + s[k])
      
print(len(ans))


Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(10):
    a = s.find(str(i))
    if a == -1: continue
    for j in range(10):
        b = s.find(str(j), a + 1)
        if b == -1: continue
        for k in range(10):
            if s.find(str(k), b + 1) != -1:
                ans += 1
print(ans)

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


ans = []
for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if s[i] + s[j] + s[k] not in ans:
        ans.append(s[i] + s[j] + s[k])
      
print(len(ans))


Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(10):
    a = s.find(str(i))
    if a == -1: continue
    for j in range(10):
        b = s.find(str(j), a + 1)
        if b == -1: continue
        for k in range(10):
            if s.find(str(k), b + 1) != -1:
                ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())


ans = []
for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
    if s[i] + s[j] + s[k] not in ans:
      ans.append(s[i] + s[j] + s[k])
      
print(len(ans))

Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(10):
    a = s.find(str(i))
    if a == -1: continue
    for j in range(10):
        b = s.find(str(j), a + 1)
        if b == -1: continue
        for k in range(10):
            if s.find(str(k), b + 1) != -1:
                ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())

div_c = b//c - a//c
div_d = b//d - a//d
lcm_cd = c*d//math.gcd(c, d)
div_cd = b//lcm_cd - a//lcm_cd

print(b - a + 1 - div_c - div_d + div_cd)

Fixed submission:
from fractions import gcd

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

div_c = b//c - a//c
if a%c == 0: div_c += 1
div_d = b//d - a//d
if a%d == 0: div_d += 1
lcm_cd = c*d//gcd(c, d)
div_cd = b//lcm_cd - a//lcm_cd
if a%lcm_cd == 0: div_cd += 1
print(b - a + 1 - div_c - div_d + div_cd)

Buggy python submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())

div_c = b//c - a//c
div_d = b//d - a//d
lcm_cd = c*d//math.gcd(c, d)
div_cd = b//lcm_cd - a//lcm_cd

print(b - a + 1 - div_c - div_d + div_cd)

Fixed submission:
from fractions import gcd

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

div_c = b//c - a//c
if a%c == 0: div_c += 1
div_d = b//d - a//d
if a%d == 0: div_d += 1
lcm_cd = c*d//gcd(c, d)
div_cd = b//lcm_cd - a//lcm_cd
if a%lcm_cd == 0: div_cd += 1
print(b - a + 1 - div_c - div_d + div_cd)
Buggy python submission (verdict: Runtime Error):
def Fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

def solve():
    n, m = map(int, input().split())
    a = [int(input()) for _ in range(m)]

    if len(a) > 1:
        for i in range(m-1):
            if a[i+1]-a[i] <= 1:
                return 0
    
    a = a + [n]
    l = [a[0]]
    for i in range(1, m):
        l.append(a[i]-a[i-1]-1)
    l = l + [a[-1]-a[-2]]
    ans = 1
    for i in l:
        ans *= Fib(i+1)

    return ans%1000000007


print(solve())



Fixed submission:
def Fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

def solve():
    n, m = map(int, input().split())
    a = [int(input()) for _ in range(m)]

    if m > 1:
        for i in range(m-1):
            if a[i+1]-a[i] <= 1:
                return 0
    elif m == 0:
        return Fib(n+2)%1000000007

    
    a = a + [n]
    l = [a[0]]
    for i in range(1, m):
        l.append(a[i]-a[i-1]-1)
    l = l + [a[-1]-a[-2]]
    ans = 1
    for i in l:
        ans *= Fib(i+1)

    return ans%1000000007


print(solve())
Buggy python submission (verdict: Runtime Error):
def solve():
    n, m = map(int, input().split())
    x = list(map(int, input().split()))

    x.sort()
    dx = [(i, x[i+1]-x[i]) for i in range(m-1)]
    dx.sort(key = lambda x: x[1], reverse = True)
    d = [0] + [dx[i][0] for i in range(n)] + [m-1]
    d.sort()

    ans = []
    for i in range(n+1):
        ans.append(x[d[i+1]] - x[d[i]])
    ans.sort()

    return sum(ans[:n])


print(solve())


Fixed submission:
#!/usr/bin/env python3
n, m, *x = map(int, open(0).read().split())
x.sort()
print(sum(sorted(j - i for i, j in zip(x, x[1:]))[-n::-1]))
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    s = list(input())

    t = ''.join(s)
    cnt = 0
    while 'BW' in t:
        for i in range(len(s)-1):
            if s[i] == 'B' and s[i+1] == 'W':
                s[i], s[i+1] = 'W', 'B'
                cnt += 1
        t = ''.join(s)

    return cnt

if __name__ == "__main__":
    print(solve())



Fixed submission:
def solve():
    s = list(input())

    cnt = 0
    for i in range(len(s)):
        if s[i] == 'W':
            cnt += i

    w = s.count('W')
    a = [int(i) for i in range(w)]
    cnt -= sum(a)

    return cnt

if __name__ == "__main__":
    print(solve())
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

x = max(a)
m = x/2
a.remove(x)
a.sort()
ans = 10000

for i in a:
    y = abs(i - m)
    if ans >= y:
        ans = y
    else:
        break    
    z = i
      
print(x, z)

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

x = max(a)
m = x/2
a.remove(x)
a.sort()
ans = x

for i in a:
    y = abs(i - m)
    if ans >= y:
        ans = y
    else:
        break    
    z = i
      
print(x, z)

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

x = max(a)
m = x/2
a.remove(x)
a.sort()
ans = 10000
for i in a:
    y = abs(i - m)
    if ans >= y:
        ans = y
    else:
        break    
    z = i
      
print(x, z)

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

x = max(a)
m = x/2
a.remove(x)
a.sort()
ans = x

for i in a:
    y = abs(i - m)
    if ans >= y:
        ans = y
    else:
        break    
    z = i
      
print(x, z)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

x = max(a)
a.remove(x)
a.sort()
ans = 0
for i in a:
    y = cmb(x, i)
    if ans <= y:
        ans = y
    else:
        break    
    z = i
      
print(x, z)

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

x = max(a)
m = x/2
a.remove(x)
a.sort()
ans = x

for i in a:
    y = abs(i - m)
    if ans >= y:
        ans = y
    else:
        break    
    z = i
      
print(x, z)
Buggy python submission (verdict: Time Limit Exceeded):
def dxdy(n, m, x, y):
    dx = [0,0,1,1,1,-1,-1,-1]
    dy = [1,-1,0,1,-1,0,1,-1]

    cnt = 1
    for i in range(8):
        if 0<=x+dx[i] and x+dx[i]<n and 0<=y+dy[i] and y+dy[i]<m:
            cnt += 1

    return cnt

def solve():
    n, m = map(int, input().split())

    ans = 0

    for i in range(n):
        for j in range(m):
            if dxdy(n, m, i, j)%2 == 1:
                ans += 1

    return ans

print(solve())


Fixed submission:
def solve():
    n, m = map(int, input().split())

    ans = abs(0*4 + 0*(n-2)*2 + 0*(m-2)*2 + 1*(n-2)*(m-2))

    return ans

print(solve())
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]

dp = [0]*n
dp[0] = a[0][0]

for i in range(n-1):
  dp[i+1] = dp[i] + max(a[0][i+1], a[1][i])
  
print(dp[-1] + a[1][n-1])

Fixed submission:
n = int(input())
a = [list(map(int, input().split())) for _ in range(2)]

l = [0]*n

for i in range(n):
  l[i] = sum(a[0][-(i+1):-(n+1):-1]) + sum(a[1][-1:-(i+2):-1])
  
print(max(l))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

b = list(set(a))
delete = 0

for i in b:
  c = a.count(i)
  if c < i:
    delete += c
  elif c > i:
    delete += c - i
    
print(delete)

Fixed submission:
import collections

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

b = collections.Counter(a)
delete = 0

for i,j in b.items():
  i = int(i)
  if i > j:
    delete += j
  elif i < j:
    delete += j - i
    
print(delete)

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

delete = 0
b = list(set(a))

for i in b:
  if a.count(i) < i:
    delete += a.count(i)
  elif a.count(i) > i:
    delete += a.count(i) - i
    
print(delete)

Fixed submission:
import collections

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

b = collections.Counter(a)
delete = 0

for i,j in b.items():
  i = int(i)
  if i > j:
    delete += j
  elif i < j:
    delete += j - i
    
print(delete)
Buggy python submission (verdict: Runtime Error):
a,b,c = [int(i), for i in input()]

print(a+b+c)


Fixed submission:
a,b,c = [int(i) for i in input()]

print(a+b+c)
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    n = int(input())
    a = [int(input()) for _ in range(n)]

    ans = 0
    for i in a:
        num = a.count(i)
        if num%2 == 1:
            ans += 1

    return ans

if __name__ == "__main__":
    print(solve())



Fixed submission:
import collections
def solve():
    n = int(input())
    a = [int(input()) for _ in range(n)]

    c = collections.Counter(a)

    num = list(c.values())
    ans = 0
    for i in range(len(num)):
        if num[i]%2 == 1:
            ans += 1

    return ans

if __name__ == "__main__":
    print(solve())

Buggy python submission (verdict: Runtime Error):
def solve():
    n = int(input())
    a = [int(input()) for _ in range(n)]

    ten = [0]*int(1e9)
    for i in range(n):
        ten[i] += 1

    ten.remove(0)
    ans = 0
    for i in range(len(ten)):
        if ten[i]%2 == 1:
            ans += 1


    return ans

if __name__ == "__main__":
    print(solve())

Fixed submission:
import collections
def solve():
    n = int(input())
    a = [int(input()) for _ in range(n)]

    c = collections.Counter(a)

    num = list(c.values())
    ans = 0
    for i in range(len(num)):
        if num[i]%2 == 1:
            ans += 1

    return ans

if __name__ == "__main__":
    print(solve())
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = [0] * int(1e5)
for i in range(n):
    ans[a[i]-1] += 1
    ans[a[i]] += 1
    ans[a[i]+1] += 1
print(max(ans))





Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0] * (int(1e5)+5)
for i in range(n):
    ans[a[i]-1] += 1
    ans[a[i]] += 1
    ans[a[i]+1] += 1
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]

b = set(a)
c = []
for i in b:
  x = a.count(i)
  c.append([i, x])

t = []
m = len(c)
for j in range(m):
  total = c[j][1]
  
  if c[j][0]-1 in b:
    total += c[j-1][1]
  
  if c[j][0]+1 in b:
    total += c[j+1][1]

  t.append(total)

print(max(t))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0] * (int(1e5)+5)
for i in range(n):
    ans[a[i]-1] += 1
    ans[a[i]] += 1
    ans[a[i]+1] += 1
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]

b = set(a)
c = []
for i in b:
  c.append([i, a.count(i)])

t = []
m = len(c)
for j in range(m):
  total = c[j][1]
  
  if c[j][0]-1 in b:
    total += c[j-1][1]
  
  if c[j][0]+1 in b:
    total += c[j+1][1]

  t.append(total)

print(max(t))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0] * (int(1e5)+5)
for i in range(n):
    ans[a[i]-1] += 1
    ans[a[i]] += 1
    ans[a[i]+1] += 1
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]

b = set(a)
c = []
for i in b:
  c.append([i, a.count(i)])

t = []
for j in range(len(c)):
  total = c[j][1]
  
  if c[j][0]-1 in b:
    total += c[j-1][1]
  
  if c[j][0]+1 in b:
    total += c[j+1][1]

  t.append(total)

print(max(t))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0] * (int(1e5)+5)
for i in range(n):
    ans[a[i]-1] += 1
    ans[a[i]] += 1
    ans[a[i]+1] += 1
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]

b = set(a)
c = []
for i in b:
  c.append([i, a.count(i)])

t = []
for j in range(len(c)):
  total = 0
  total += c[j][1]
  
  if c[j][0]-1 in b:
    total += c[j-1][1]
  
  if c[j][0]+1 in b:
    total += c[j+1][1]

  t.append(total)

print(max(t))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0] * (int(1e5)+5)
for i in range(n):
    ans[a[i]-1] += 1
    ans[a[i]] += 1
    ans[a[i]+1] += 1
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]

b = set(a)
c = []
for i in b:
  c.append([i, a.count(i)])

t = []
for j in range(len(c)):
  total = 0
  total += c[j][1]
  
  if c[j][0]-1 in a:
    total += c[j-1][1]
  
  if c[j][0]+1 in a:
    total += c[j+1][1]

  t.append(total)

print(max(t))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0] * (int(1e5)+5)
for i in range(n):
    ans[a[i]-1] += 1
    ans[a[i]] += 1
    ans[a[i]+1] += 1
print(max(ans))
Buggy python submission (verdict: Runtime Error):
import string

s = set(input())

abc = set(string.ascii_lowercase)
rest = abc - s

print(min(rest))

Fixed submission:
import string

s = set(input())

abc = set(string.ascii_lowercase)
rest = abc - s

if rest:
  print(min(rest))
else:
  print('None')
Buggy python submission (verdict: Runtime Error):
from collections import Counter
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    l = Counter(a)
    tw = []
    fo = []
    for i,j in l.items():
        if j >= 2:
            tw.append(i)
        if j >= 4:
            fo.append(i)

    if len(tw) >= 2 or len(fo) >= 1:
        tw.sort()
        fo.sort()
        return max(tw[-1]*tw[-2], fo[-1]**2)
    else:
        return 0
    

print(solve())


Fixed submission:
from collections import Counter
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    l = Counter(a)
    tw = []
    fo = []
    for i,j in l.items():
        if j >= 2:
            tw.append(i)
        if j >= 4:
            fo.append(i)
    ans = 0
    if len(tw) >= 2:
        tw.sort()
        ans = max(ans, tw[-1]*tw[-2])
    if fo:
        fo.sort()
        ans = max(ans, fo[-1]**2)
    
    return ans
    

print(solve())

Buggy python submission (verdict: Runtime Error):
from collections import Counter
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    l = Counter(a)
    tw = []
    fo = []
    for i,j in l.items():
        if j >= 2:
            tw.append(i)
        if j >= 4:
            fo.append(i)

    if len(tw) >= 2 or fo:
        tw.sort()
        return max(tw[-1]*tw[-2], fo[-1]**2)
    else:
        return 0
    

print(solve())


Fixed submission:
from collections import Counter
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    l = Counter(a)
    tw = []
    fo = []
    for i,j in l.items():
        if j >= 2:
            tw.append(i)
        if j >= 4:
            fo.append(i)
    ans = 0
    if len(tw) >= 2:
        tw.sort()
        ans = max(ans, tw[-1]*tw[-2])
    if fo:
        fo.sort()
        ans = max(ans, fo[-1]**2)
    
    return ans
    

print(solve())
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = []
for x in range(1, n):
  y = n - x
  dis = abs(sum(a[:x]) - sum(a[x:]))
  ans.append(dis)

print(min(ans))

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

total = sum(a)
ans = []
for x in range(n-1):
  total -= 2*a[x]
  ans.append(abs(total))

print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    b= []
    cnt = 0
    while cnt < n:
        b = b[::-1] + [a[cnt]]
        cnt += 1


    return b[::-1]
    

print(*solve())


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

    b = a[1::2]
    c = a[::2]
    
    if len(a)%2 == 0:
        return b[::-1] + c
    else:
        return c[::-1] + b
    

print(*solve())
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]

b = 0
cnt = 0
while cnt <= 100000:
  b = a[b]
  cnt += 1
  if b == 1:
    break
  
if cnt > 100000:
  print(-1)
else:
  print(cnt)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]

b = 1
cnt = 0
while cnt <= 100000:
  b = a[b-1]
  cnt += 1
  if b == 2:
    break
  
if cnt > 100000:
  print(-1)
else:
  print(cnt)