Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
count = 0
tmp = 0
while(1):
    if a[0] == 1:
        tmp = a[0]
        break
    else:
        count += 1
        a.pop(0)
        if not a:
            break
if tmp == 1:
    for i in range(1,N-count):
        if a[i] == tmp + 1:
            tmp = a[i]
        else:
            count += 1
    print(count)
else:
    print(-1)


Fixed submission:
N = int(input())
a = list(map(int,input().split()))
b = 1
ans = 0
for i in range(0,N):
    if a[i] == b:
        b += 1
        ans += 1
if ans == 0:
    print(-1)
else:
    print(N-ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
count = 0
tmp = 0
while(1):
    if a[0] == 1:
        tmp = a[0]
        break
    else:
        count += 1
        a.pop(0)
        if not a:
            break
if tmp == 1:
    for i in range(1,N-count):
        if a[i] == tmp + 1:
            tmp = a[i]
        else:
            count += 1
    print(count)
else:
    print(-1)


Fixed submission:
N = int(input())
a = list(map(int,input().split()))
b = 1
ans = 0
for i in range(0,N):
    if a[i] == b:
        b += 1
        ans += 1
if ans == 0:
    print(-1)
else:
    print(N-ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
count = 0
tmp = 0
while(1):
    if a[0] == 1:
        tmp = a[0]
        break
    else:
        count += 1
        a.pop(0)
if tmp == 1:
    for i in range(1,N-count):
        if a[i] == tmp + 1:
            tmp = a[i]
        else:
            count += 1
    print(count)
else:
    print(-1)






Fixed submission:
N = int(input())
a = list(map(int,input().split()))
b = 1
ans = 0
for i in range(0,N):
    if a[i] == b:
        b += 1
        ans += 1
if ans == 0:
    print(-1)
else:
    print(N-ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
count=0
while(1):
    if a[0]==1:
        tmp = a[0]
        break
    else:
        count += 1
        a.pop(0)
for i in range(1,N-count):
    if a[i] == tmp + 1:
        tmp=a[i]
    else:
        count+=1
print(count)






Fixed submission:
N = int(input())
a = list(map(int,input().split()))
b = 1
ans = 0
for i in range(0,N):
    if a[i] == b:
        b += 1
        ans += 1
if ans == 0:
    print(-1)
else:
    print(N-ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int, input().split()))
ans = 1
for e in l:
    ans *= e

if ans > 10 ** 18:
    print('-1')
else:
    print(str(ans))

Fixed submission:
import sys
N = int(input())
l = list(map(int, input().split()))
ans = 1

if 0 in l:
    print('0')
    sys.exit()
    
for e in l:
    ans *= e
    if ans > 10 ** 18:
        print('-1')
        sys.exit()

print(str(ans))
Buggy python submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
l = [1] * a + [0] * b + [-1] * c
print(sum(l[:k]))

Fixed submission:
a, b, c, k = map(int, input().split())

if k <= a:
    sum = k
elif k <= a + b:
    sum = a
else:
    sum = a - (k - a - b)

print(sum)

Buggy python submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
l = [1] * a + [0] * b + [-1] * c
print(sum(l[:k]))

Fixed submission:
a, b, c, k = map(int, input().split())

if k <= a:
    sum = k
elif k <= a + b:
    sum = a
else:
    sum = a - (k - a - b)

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
K = int(input())
sum = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            nums = [a, b, c]
            gcd = reduce(math.gcd, nums)
            sum += gcd
print(sum)

Fixed submission:
from math import gcd
K = int(input())
sum = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        p = gcd(a, b)
        for c in range(1, K+1):
            sum += gcd(p, c)
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
cards = {i: False for i in range(1, n+1)}

for _ in range(m):
    l, r = map(int, input().split())
    for i in cards:
        if i < l or i > r:
            cards[i] = True

sum = 0
for v in cards.values():
    if not v:
        sum += 1

print(sum)

Fixed submission:
n, m = map(int, input().split())
max_l = 1
min_r = n 

for _ in range(m):
    l, r = map(int, input().split())
    max_l = max(max_l, l)
    min_r = min(min_r, r)

ans = max(min_r - max_l + 1, 0)
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
l = len(bin(a_max)) - 2
bits = np.zeros((l,2))
for num in a:
    for i, bit in enumerate(format(num, 'b').zfill(l)):
        if bit == '0':
            bits[i,0] += 1
        else:
            bits[i,1] += 1

sumation = 0
div = (10**9+7)
for i in range(l):
    sumation += (bits[i,0]) * (bits[i, 1]) * (2**(l-i-1) % div)
print(int(sumation % (10**9+7)))
    

Fixed submission:
a, b, c = map(int, input().split())
if a + b + c >= 22:
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
l = len(bin(a_max)) - 2
bits = np.zeros((l,2))
for num in a:
    for i, bit in enumerate(format(num, 'b').zfill(l)):
        if bit == '0':
            bits[i,0] += 1
        else:
            bits[i,1] += 1

sumation = 0
div = (10**9+7)
for i in range(l):
    sumation += (bits[i,0]) * (bits[i, 1]) * (2**(l-i-1) % div)
print(int(sumation % (10**9+7)))
    

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
l = len(bin(a_max)) - 2
bits = [[0, 0] for _ in range(l)]
for num in a:
    for i, bit in enumerate(format(num, 'b').zfill(l)):
        if bit == '0':
            bits[i][0] += 1
        else:
            bits[i][1] += 1

sumation = 0
div = (10**9+7)
for i in range(l):
    sumation += (bits[i][0]) * (bits[i][1]) * (2**(l-i-1) % div)
print(int(sumation % (10**9+7)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
l = len(bin(a_max)) - 2
bits = np.zeros((l,2))
for num in a:
    for i, bit in enumerate(format(num, 'b').zfill(l)):
        if bit == '0':
            bits[i,0] += 1
        else:
            bits[i,1] += 1

sumation = 0
for i in range(l):
    sumation += bits[i,0] * bits[i, 1] * 2**(l-i-1)
print(int(sumation % (10**9+7)))
    

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
l = len(bin(a_max)) - 2
bits = [[0, 0] for _ in range(l)]
for num in a:
    for i, bit in enumerate(format(num, 'b').zfill(l)):
        if bit == '0':
            bits[i][0] += 1
        else:
            bits[i][1] += 1

sumation = 0
div = (10**9+7)
for i in range(l):
    sumation += (bits[i][0]) * (bits[i][1]) * (2**(l-i-1) % div)
print(int(sumation % (10**9+7)))
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split(" "))))
b = list(np.argsort(a) + 1)
b = [str(s) for s in b]
print(" ".join(b))

Fixed submission:
n = int(input())
print((int(n/2) + n%2) / n)
Buggy python submission (verdict: Runtime Error):
LIMIT = 1000000000000001
alphabet = {1:"a", 2:"b", 3:"c", 4:"d", 5:"e", 6: "f", 7:"g", 8:"h", 9:"i", 10:"j", 11:"k",
                12:"l", 13:"m", 14: "n", 15:"o", 16:"p", 17:"q", 18:"r", 19:"s", 20:"t", 21: "u",
                22: "v", 23: "w",  24: "x",  25: "y",  26: "z"}



N = int(input())
answer = ""

while True:
    if N >= 27:
        a = int(N / 26)
        b = int(N % 26)
        answer += alphabet[b]
        N = a
    else:
        answer += alphabet[N]
        break

print(answer[::-1])




Fixed submission:
LIMIT = 1000000000000001
alphabet = {-1: "!", 0: "a", 1:"b", 2:"c", 3:"d", 4:"e", 5:"f", 6: "g", 7:"h", 8:"i", 9:"j", 10:"k", 11:"l",
                12:"m", 13:"n", 14: "o", 15:"p", 16:"q", 17:"r", 18:"s", 19:"t", 20:"u", 21: "v",
                22: "w", 23: "x",  24: "y",  25: "z"}



N = int(input())
answer = ""
# times = 1

while True:
    N = N - 1
    a = int(N / 26)
    b = N % 26
    answer += alphabet[b]
    if a == 0: break
    N = a


print(answer[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
LIMIT = 1000000000000000000

N = int(input())
A = map(int, input().split())
answer = 1

for e in A:
    answer *= e

if answer > LIMIT:
    print(-1)
else:
    print(answer)



Fixed submission:
LIMIT = 1000000000000000000

def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト
    answer = 1

    for i in range(N):
        answer *= a[i]
        if answer > LIMIT:
            if 0 in a[i:]:
                print(0)
                return
            else:
                print(-1)
            return

    print(answer)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
LIMIT = 1000000000000000000

def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト
    answer = 1

    for i in range(N):
        answer *= a[i]

    if answer > LIMIT:
        print(-1)
    else:
        print(answer)


if __name__ == '__main__':
    main()


Fixed submission:
LIMIT = 1000000000000000000

def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト
    answer = 1

    for i in range(N):
        answer *= a[i]
        if answer > LIMIT:
            if 0 in a[i:]:
                print(0)
                return
            else:
                print(-1)
            return

    print(answer)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
LIMIT = 1000000000000000000

def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト

    answer = 1

    for i in a:
        answer = answer * i

    if answer > LIMIT:
        print(-1)
    else:
        print(answer)


if __name__ == '__main__':
    main()


Fixed submission:
LIMIT = 1000000000000000000

def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト
    answer = 1

    for i in range(N):
        answer *= a[i]
        if answer > LIMIT:
            if 0 in a[i:]:
                print(0)
                return
            else:
                print(-1)
            return

    print(answer)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())  # 文字列または整数(一変数)
    A = list(map(int, input().split()))  # 整数のリスト

    answer = 0

    for i in range(1, N+1):
        for j in range(i+1, N+1):
            if A[j-1] + A[i-1] == abs(j - i):
                answer += 1

    print(answer)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = input()  # 文字列または整数(一変数)

    if N == "ABC":
        print("ARC")
    else:
        print("ABC")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()[::-1]

    sum_of_digits = 0

    cnts = [0] * 2019

    cnts[0] = 1

    for i in range(len(s)):
        sum_of_digits += int(s[i]) * pow(10, i) % 2019
        sum_of_digits %= 2019
        cnts[sum_of_digits] += 1


    ans = 0

    for cnt in cnts:
        ans += cnt * (cnt - 1) // 2

    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    s = input()[::-1]

    sum_of_digits = 0

    cnts = [0] * 2019

    cnts[0] = 1

    d = 1

    for i in range(len(s)):
        sum_of_digits += int(s[i]) * d
        d *= 10
        d %= 2019
        sum_of_digits %= 2019
        cnts[sum_of_digits] += 1


    ans = 0

    for cnt in cnts:
        ans += cnt * (cnt - 1) // 2

    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()[::-1]

    sum_of_digits = 0

    cnts = [0] * 2019

    cnts[0] = 1

    for i in range(len(s)):
        sum_of_digits += int(s[i]) * pow(10, i)
        sum_of_digits %= 2019
        cnts[sum_of_digits] += 1

    ans = 0

    for cnt in cnts:
        ans += cnt * (cnt - 1) // 2

    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    s = input()[::-1]

    sum_of_digits = 0

    cnts = [0] * 2019

    cnts[0] = 1

    d = 1

    for i in range(len(s)):
        sum_of_digits += int(s[i]) * d
        d *= 10
        d %= 2019
        sum_of_digits %= 2019
        cnts[sum_of_digits] += 1


    ans = 0

    for cnt in cnts:
        ans += cnt * (cnt - 1) // 2

    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def calc_double(n):
    return n * 2

def main():
    N = int(input())
    S = input()
    r = []
    g = []
    b = []
    answer = 0

    for i in range(len(S)):
        # print(S[i])
        if S[i] == 'R':
            r.append(i)
            continue
        if S[i] == 'G':
            g.append(i)
            continue
        b.append(i)


    # print(r)
    # print(g)
    # print(b)
    # print()
    rg = [(i+j) for i in r for j in g]
    gb = [(i+j) for i in g for j in b]
    br = [(i+j) for i in b for j in r]

    # for i in r:
    #     if i in gb: answer += 1
    #
    # for i in g:
    #     if i in br: answer += 1
    #
    # for i in b:
    #     if i in rg: answer += 1
    #
    # print("answer")
    # print(answer)
    # print()

    r = list(map(calc_double, r))
    g = list(map(calc_double, g))
    b = list(map(calc_double, b))


    for i in gb:
        if i in r: answer += 1

    for i in br:
        if i in g: answer += 1

    for i in rg:
        if i in b: answer += 1
    #
    # print("answer")
    # print(answer)
    # print()
    #
    # rg.sort()
    # print(rg)
    # print(b)
    # print()
    # gb.sort()
    # print(gb)
    # print(r)
    # print()
    # br.sort()
    # print(br)
    # print(g)
    #
    # print(len(set(rg) & set(b)))
    # print(len(set(gb) & set(r)))
    # print(len(set(br) & set(g)))

    print(len(r) * len(g) * len(b) - answer)

if __name__ == '__main__':
    main()


Fixed submission:
from time import time

def main():
    N = int(input())
    S = input()

    r = S.count('R')
    g = S.count('G')
    b = S.count('B')
    answer = r * g * b

    for i in range(N):
        for j in range(i, N):
            k = 2*j - i
            if k >= N: continue
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]: answer -= 1
    print(answer)

if __name__ == '__main__':
    start = time()
    main()
    # print(time() - start)
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial


def c(n):
    if n < 2:
        return 0
    return factorial(n) // (factorial(n-2) * factorial(2))


def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト
    for i in range(N):
        a[i] -= 1

    nums = [0 for _ in range(N)]

    for i in a:
        nums[i] += 1

    b = [c(nums[i]) for i in range(N)]
    sum_b = sum(b)

    b_alt = [c(nums[i]-1) for i in range(N)]

    for i in range(N):
        print(sum_b - b[a[i]] + b_alt[a[i]])


if __name__ == '__main__':
    main()


Fixed submission:

def main():
    N = int(input())
    A = list(map(int, input().split()))

    # print(N)
    # print(A)
    d = {i:0 for i in range(1,N+1)}
    d2 = {}
    d3 = {}
    # print(d)
    # return


    for i in A:
        d[i] += 1

    # print(d)
    sum = 0
    for i in range(1,N+1):
        d2[i] = int(d[i] * (d[i]-1) / 2)
        sum += d2[i]

    # print(d2)

    for i in range(1, N+1):
        if d[i] == 0: d3[i] = 0
        else: d3[i] = int((d[i]-1) * (d[i]-2) / 2)

    # print(d3)


    for i in A:
        print(sum - d2[i] + d3[i])

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial


def c(n):
    if n < 2:
        return 0
    return factorial(n) // (factorial(n-2) * factorial(2))


def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト
    for i in range(N):
        a[i] -= 1

    nums = [0 for _ in range(N)]

    for i in a:
        nums[i] += 1

    b = [c(nums[i]) for i in range(N)]
    sum_b = sum(b)

    for i in range(N):
        print(sum_b - b[a[i]] + c(nums[a[i]] - 1))


if __name__ == '__main__':
    main()


Fixed submission:

def main():
    N = int(input())
    A = list(map(int, input().split()))

    # print(N)
    # print(A)
    d = {i:0 for i in range(1,N+1)}
    d2 = {}
    d3 = {}
    # print(d)
    # return


    for i in A:
        d[i] += 1

    # print(d)
    sum = 0
    for i in range(1,N+1):
        d2[i] = int(d[i] * (d[i]-1) / 2)
        sum += d2[i]

    # print(d2)

    for i in range(1, N+1):
        if d[i] == 0: d3[i] = 0
        else: d3[i] = int((d[i]-1) * (d[i]-2) / 2)

    # print(d3)


    for i in A:
        print(sum - d2[i] + d3[i])

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from DataStructures.UnionFind import UnionFind


def main():
    N, M, K = map(int, input().split())
    cnt = [0] * N
    uf = UnionFind(N)

    for _ in range(M):
        A, B = map(lambda x: int(x)-1, input().split())
        cnt[A] += 1
        cnt[B] += 1
        uf.union(A, B)

    for _ in range(K):
        C, D = map(lambda x: int(x)-1, input().split())
        if uf.same(C, D):
            cnt[C] += 1
            cnt[D] += 1

    for i in range(N):
        print(uf.size(i) - cnt[i] - 1, end=" ")


if __name__ == '__main__':
    main()



Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n  # 要素の総数．
        self.parents = [-1] * n  # 各要素の親要素の番号を格納するリスト．要素がrootの場合は-(そのグループの要素数)を返す

    def find(self, x):
        """要素xが属するグループの根を返す"""
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        """要素xが属するグループと要素yが属するグループとを併合する"""
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        """要素xが属するグループの要素数を返す"""
        return -self.parents[self.find(x)]

    def same(self, x, y):
        """要素x, yが同じグループに属するかどうかを返す"""
        return self.find(x) == self.find(y)

    def members(self, x):
        """要素xが属するグループに属する要素をリストで返す"""
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        """全ての根の要素をリストで返す"""
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        """グループの数を返す"""
        return len(self.roots())

    def all_group_members(self):
        """{ルート要素: [そのグループの要素のリスト]} の辞書を返す"""
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    N, M, K = map(int, input().split())
    cnt = [0] * N
    uf = UnionFind(N)

    for _ in range(M):
        A, B = map(lambda x: int(x)-1, input().split())
        cnt[A] += 1
        cnt[B] += 1
        uf.union(A, B)

    for _ in range(K):
        C, D = map(lambda x: int(x)-1, input().split())
        if uf.same(C, D):
            cnt[C] += 1
            cnt[D] += 1

    for i in range(N):
        print(uf.size(i) - cnt[i] - 1, end=" ")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    min_costs = [0 for i in range(N)]
    min_costs[1] = abs(h[1] - h[0])


    for i in range(2, N):
        min_cost = 1000000000
        for j in range(1, K+1):
            if i-j < 0: break
            cost = abs(h[i] - h[i-j]) + min_costs[i-j]
            if cost < min_cost:
                min_cost = cost
        min_costs[i] = min_cost

    
    print(min_costs[N-1])



if __name__ == '__main__':
    main()



Fixed submission:
def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    min_costs = [0 for i in range(N)]
    min_costs[1] = abs(h[1] - h[0])


    for i in range(2, N):
        min_cost = 1000000000
        for j in range(1, K+1):
            if i-j < 0: break
            cost = abs(h[i] - h[i-j]) + min_costs[i-j]
            if cost < min_cost:
                min_cost = cost
        min_costs[i] = min_cost

    
    print(min_costs[N-1])



if __name__ == '__main__':
    main()

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

def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    min_costs = [0 for i in range(N)]
    min_costs[1] = abs(h[1] - h[0])


    for i in range(2, N):
        min_cost = 1000000000
        for j in range(1, K+1):
            if i-j < 0: break
            cost = abs(h[i] - h[i-j]) + min_costs[i-j]
            if cost < min_cost:
                min_cost = cost
        min_costs[i] = min_cost

    print(min_costs[N-1])



if __name__ == '__main__':
    start = time()
    main()
    # print(time() - start)



Fixed submission:
def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    min_costs = [0 for i in range(N)]
    min_costs[1] = abs(h[1] - h[0])


    for i in range(2, N):
        min_cost = 1000000000
        for j in range(1, K+1):
            if i-j < 0: break
            cost = abs(h[i] - h[i-j]) + min_costs[i-j]
            if cost < min_cost:
                min_cost = cost
        min_costs[i] = min_cost

    
    print(min_costs[N-1])



if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    a = map(int, input().split())
    d = {i: 0 for i in range(100001)}

    for i in a:
        d[i-1] += 1
        d[i] += 1
        d[i+1] += 1

    print(max(d.values()))

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    a = map(int, input().split())
    d = {i: 0 for i in range(-1, 100001)}

    for i in a:
        d[i-1] += 1
        d[i] += 1
        d[i+1] += 1

    print(max(d.values()))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

sum = 1
for i in A:
    sum *= i

ans = -1

if sum <= 10**18:
    ans = sum

print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

A.sort()

sum = 1
for i in A:
    sum *= i
    if sum > 10**18:
        sum = -1
        break

ans = sum

print(ans)