Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
S = [hash(''.join(sorted(input()))) for _ in range(n)]
T = set(S)
c = []

for i in T:
    c.append(S.count(i))
            
for j in c:
    ans += (j * (j-1) // 2)
print(ans)

Fixed submission:
n = int(input())
ans = 0
S = {}
for _ in range(n):
    s = ''.join(sorted(input()))
    if s in S.keys():
        S[s] += 1
    else:
        S[s] = 1

for i in S.values():
    ans += (i*(i-1)) // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
S = [sorted(input()) for _ in range(n)]

for i in range(n):
    for j in range(i+1, n):
        a = S[i]
        b = S[j]
        if a == b:
            ans += 1
            
print(ans)

Fixed submission:
n = int(input())
ans = 0
S = {}
for _ in range(n):
    s = ''.join(sorted(input()))
    if s in S.keys():
        S[s] += 1
    else:
        S[s] = 1

for i in S.values():
    ans += (i*(i-1)) // 2
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

l, r = map(int, input().split())
e = 2019
e1 = 3
e2 = e // e1

if r-l == 1:
    print(l*r % e)
else:
    if divmod(l,e2)[0] < divmod(r,e2)[0]:
        print(0)
    else:
        if r < e
            print(r*(r-1) % e)
        elif e < l:
            print(l*(l+1) % e)

Fixed submission:
l, r = map(int, input().split())
ans = 2019
if r-l > 2019:
    print(0)
else:
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            mod = divmod(i*j, 2019)[-1]
            if mod < ans:
                ans = mod
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
dp = [0] * (N+2)
dp[1] = 1
e = 1e9 + 7
for i in range(2, N+2):
    if i-1 not in A:
        dp[i] = (dp[i-1] + dp[i-2]) % e
print(int(dp[-1]))

Fixed submission:
n, m = map(int, input().split())
mod = 1e+9+7
dp = [0]*(n+1)
dp[0] = 1
isPass = [1]*(n+1)
for _ in range(m):
    a = int(input())
    isPass[a] = 0
for i in range(n):
    for j in range(i+1, min(n, i+2)+1):
        if isPass[j]:
            dp[j] += dp[i]
            dp[j] %= mod
print(int(dp[n]))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
dp = [0] * (N+1)
dp[0] = 1
e = 1e9 + 7
for i in range(1, N+1):
    if i not in A:
        if i == 1:
            dp[i] = 1
            continue
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % e
print(int(dp[N]))

Fixed submission:
n, m = map(int, input().split())
mod = 1e+9+7
dp = [0]*(n+1)
dp[0] = 1
isPass = [1]*(n+1)
for _ in range(m):
    a = int(input())
    isPass[a] = 0
for i in range(n):
    for j in range(i+1, min(n, i+2)+1):
        if isPass[j]:
            dp[j] += dp[i]
            dp[j] %= mod
print(int(dp[n]))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
dp = [0] * (N+1)
dp[0] = 1
e = 1e9 + 7
for i in range(1, N+1):
    if i not in A:
        if i == 1:
            dp[i] = 1
            continue
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % e
print(int(dp[N])

Fixed submission:
n, m = map(int, input().split())
mod = 1e+9+7
dp = [0]*(n+1)
dp[0] = 1
isPass = [1]*(n+1)
for _ in range(m):
    a = int(input())
    isPass[a] = 0
for i in range(n):
    for j in range(i+1, min(n, i+2)+1):
        if isPass[j]:
            dp[j] += dp[i]
            dp[j] %= mod
print(int(dp[n]))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
ans = 0
for i in range(m):
    l,r = map(int, input().split())
    tmp = set(range(l,r+1))
    if i == 0:
        ans = tmp
    else:
        ans = ans & tmp

print(len(ans))

Fixed submission:
n,m = map(int, input().split())
ans = 0
L = -100000000
R = 100000000
for i in range(m):
    l,r = map(int, input().split())
    if l > L:
        L = l
    if r < R:
        R = r

print(len(range(L,R+1)))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
ans = set(range(1,n+1))
for i in range(m):
    l,r = map(int, input().split())
    tmp = set(range(l,r+1))
    ans = ans & tmp

print(len(ans))

Fixed submission:
n,m = map(int, input().split())
ans = 0
L = -100000000
R = 100000000
for i in range(m):
    l,r = map(int, input().split())
    if l > L:
        L = l
    if r < R:
        R = r

print(len(range(L,R+1)))
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from fractions import gcd

n = int(input())
A = [int(a) for a in input().split()]

l = [0 for _ in range(n)]
r = [0 for _ in range(n)]
ans = []

for i in range(n):
    l[i] = reduce(gcd,[0]+A[:i])
    r[i] = reduce(gcd,A[i+1:]+[0])
    
for i in range(n):
    ans.append(gcd(l[i],r[i]))
    
print(max(ans))

Fixed submission:
from functools import reduce
from fractions import gcd

n = int(input())
A = [int(a) for a in input().split()]

l = [0 for _ in range(n+1)]
r = [0 for _ in range(n+1)]
ans = []

for i in range(n):
    l[i+1] = gcd(l[i],A[i])

for i in range(n-1,-1,-1):
    r[i-1] = gcd(r[i],A[i])
    
for i in range(n):
    ans.append(gcd(l[i],r[i]))
    
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce

n = int(input())
A = [int(a) for a in input().split()]

ans = []
for i in range(len(A)):
    tmp = A[i]
    L = reduce(gcd, [0] + A[:i])
    R = reduce(gcd, A[i+1:] + [0])
    ans.append(gcd(L,R))
        
print(max(ans))

Fixed submission:
from functools import reduce
from fractions import gcd

n = int(input())
A = [int(a) for a in input().split()]

l = [0 for _ in range(n+1)]
r = [0 for _ in range(n+1)]
ans = []

for i in range(n):
    l[i+1] = gcd(l[i],A[i])

for i in range(n-1,-1,-1):
    r[i-1] = gcd(r[i],A[i])
    
for i in range(n):
    ans.append(gcd(l[i],r[i]))
    
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce

n = int(input())
A = [int(a) for a in input().split()]
ans = 1
for i in range(len(A)):
    B = A.copy()
    B.pop(i)
    _ = reduce(gcd, B)
    if _ > ans:
        ans = _
        
print(ans)

Fixed submission:
from functools import reduce
from fractions import gcd

n = int(input())
A = [int(a) for a in input().split()]

l = [0 for _ in range(n+1)]
r = [0 for _ in range(n+1)]
ans = []

for i in range(n):
    l[i+1] = gcd(l[i],A[i])

for i in range(n-1,-1,-1):
    r[i-1] = gcd(r[i],A[i])
    
for i in range(n):
    ans.append(gcd(l[i],r[i]))
    
print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
S = input() + 'X'
T = [0]*n
for i in range(n):
    s = S[i:i+2]
    if s == 'AC':
        T[i] = 1
for _ in range(q):
    l,r = map(int, input().split())
    print(sum(T[l-1:r-1]))

Fixed submission:
n, q = map(int, input().split())
S = 'X' + input()
T = [0]*(n+1)
for i in range(n):
    s = S[i:i+2]
    if s == 'AC':
        T[i+1] = T[i] + 1
    else:
        T[i+1] = T[i]
for _ in range(q):
    l,r = map(int, input().split())
    print(T[r]-T[l])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
S = input()
for _ in range(q):
    l,r = map(int, input().split())
    s = S[l-1:r]
    print(s.count('AC'))

Fixed submission:
n, q = map(int, input().split())
S = 'X' + input()
T = [0]*(n+1)
for i in range(n):
    s = S[i:i+2]
    if s == 'AC':
        T[i+1] = T[i] + 1
    else:
        T[i+1] = T[i]
for _ in range(q):
    l,r = map(int, input().split())
    print(T[r]-T[l])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
ans = 0
for _ in range(q):
    l,r = map(int, input().split())
    tmp = s[l-1:r]
    ans = tmp.count('AC')
    print(ans)

Fixed submission:
n, q = map(int, input().split())
S = 'X' + input()
T = [0]*(n+1)
for i in range(n):
    s = S[i:i+2]
    if s == 'AC':
        T[i+1] = T[i] + 1
    else:
        T[i+1] = T[i]
for _ in range(q):
    l,r = map(int, input().split())
    print(T[r]-T[l])
Buggy python submission (verdict: Runtime Error):
import itertools

n,m = map(int, input().split())
AB = []
ans = 0
for n in range(n):
    a,b = map(int,input().split())
    AB.append([a,b])
AB.sort()
A,B = zip(*AB)
A,B = list(A), list(B)

i = list(_ for _ in itertools.accumulate(B) if _ <= m)

B = B[:len(i)] + [m-i[-1]]
A = A[:len(B)]

ans = sum([a*b for a,b in zip(A,B)])
print(ans)

Fixed submission:
import itertools

n,m = map(int, input().split())
AB = []
ans = 0
for n in range(n):
    a,b = map(int,input().split())
    AB.append([a,b])
AB.sort()
A,B = zip(*AB)
A,B = list(A), list(B)

i = list(_ for _ in itertools.accumulate(B) if _ <= m)
if i == []:
    ans = A[0]*m
else:
    B = B[:len(i)] + [m-i[-1]]
    A = A[:len(B)]

    ans = sum([a*b for a,b in zip(A,B)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
A = []
B = []
ans = 0
for n in range(n):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
    
while(m > 0):
    minA = min(A)
    if B[A.index(minA)] >= m:
        ans += minA*m
    else:
        ans += minA*B[A.index(minA)]
    m = m - B[A.index(minA)]
    
    B.pop(A.index(minA))
    A.pop(A.index(minA))
    
print(ans)

Fixed submission:
import itertools

n,m = map(int, input().split())
AB = []
ans = 0
for n in range(n):
    a,b = map(int,input().split())
    AB.append([a,b])
AB.sort()
A,B = zip(*AB)
A,B = list(A), list(B)

i = list(_ for _ in itertools.accumulate(B) if _ <= m)
if i == []:
    ans = A[0]*m
else:
    B = B[:len(i)] + [m-i[-1]]
    A = A[:len(B)]

    ans = sum([a*b for a,b in zip(A,B)])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]
H = sorted(H, reverse=True)
ans = 1e9
for i in range(N-K+1):
    h = H[i:i+K]
    dh = h[0]-h[-1]
    if dh < ans:
        ans = dh
print(ans)

Fixed submission:
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]
H = sorted(H)
ans = 1e9
for i in range(N-K+1):
    ans = min(ans, H[i+K-1]-H[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]
H = sorted(H, reverse=True)
ans = 1e9
for i in range(N-K+1):
    h = H[i:i+K]
    dh = max(h)-min(h)
    if dh < ans:
        ans = dh
print(ans)

Fixed submission:
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]
H = sorted(H)
ans = 1e9
for i in range(N-K+1):
    ans = min(ans, H[i+K-1]-H[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
V = list(map(int, input().split()))
countA = []
countB = []
if len(set(V)) == 1:
    print(n//2)
else:
    A = V[::2]
    B = V[1::2]
    for i in range(N//2):
        countA.append(A.count(A[i]))
        countB.append(B.count(B[i]))
    max_countA = max(countA)
    max_countB = max(countB)
    
    print(len(A)-max_countA + len(A)-max_countB)

Fixed submission:
from collections import Counter
from statistics import mode


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

A = V[::2]
B = V[1::2]
countA = sorted(list(Counter(A).items()), key=lambda x: -x[1])
countB = sorted(list(Counter(B).items()), key=lambda x: -x[1])
if len(set(V)) == 1:
    print(n//2)
elif countA[0][0] != countB[0][0]:
    print(len(A)-countA[0][1] + len(B)-countB[0][1])
else:
    print(min(
        len(A)-countA[0][1] + len(B)-countB[1][1],
        len(A)-countA[1][1] + len(B)-countB[0][1]
        ))

Buggy python submission (verdict: Runtime Error):
n = int(input())
V = list(map(int, input().split()))
if len(set(V)) == 1:
    print(n//2)
else:
    A = V[::2]
    B = V[1::2]
    for _ in range(N//2):
        countA = [A.count(a) for a in set(A)]
        countB = [B.count(b) for b in set(B)]
    max_countA = max(countA)
    max_countB = max(countB)
    
    print(len(A)-max_countA + len(A)-max_countB)

Fixed submission:
from collections import Counter
from statistics import mode


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

A = V[::2]
B = V[1::2]
countA = sorted(list(Counter(A).items()), key=lambda x: -x[1])
countB = sorted(list(Counter(B).items()), key=lambda x: -x[1])
if len(set(V)) == 1:
    print(n//2)
elif countA[0][0] != countB[0][0]:
    print(len(A)-countA[0][1] + len(B)-countB[0][1])
else:
    print(min(
        len(A)-countA[0][1] + len(B)-countB[1][1],
        len(A)-countA[1][1] + len(B)-countB[0][1]
        ))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
V = list(map(int, input().split()))
if len(set(V)) == 1:
    print(n//2)
else:
    A = V[::2]
    B = V[1::2]
    max_countA = max([A.count(a) for a in set(A)])
    max_countB = max([B.count(b) for b in set(B)])
    
    print(len(A)-max_countA + len(A)-max_countB)

Fixed submission:
from collections import Counter
from statistics import mode


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

A = V[::2]
B = V[1::2]
countA = sorted(list(Counter(A).items()), key=lambda x: -x[1])
countB = sorted(list(Counter(B).items()), key=lambda x: -x[1])
if len(set(V)) == 1:
    print(n//2)
elif countA[0][0] != countB[0][0]:
    print(len(A)-countA[0][1] + len(B)-countB[0][1])
else:
    print(min(
        len(A)-countA[0][1] + len(B)-countB[1][1],
        len(A)-countA[1][1] + len(B)-countB[0][1]
        ))
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

n,x = map(int, input().split())
X = [int(i) for i in input().split()]
X = [abs(x-j) for j in X]
ans = reduce(math.gcd, X)
print(ans)

Fixed submission:
from fractions import gcd
from functools import reduce

n,x = map(int, input().split())
X = [int(i) for i in input().split()]
X = [abs(x-j) for j in X]
ans = reduce(gcd, X)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

n,x = map(int, input().split())
X = [int(i) for i in input().split()]
X = [abs(x-j) for j in X]
print(reduce(math.gcd, X))

Fixed submission:
from fractions import gcd
from functools import reduce

n,x = map(int, input().split())
X = [int(i) for i in input().split()]
X = [abs(x-j) for j in X]
ans = reduce(gcd, X)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math, functools

N, X = map(int, input().split())
x = [int(x) for x in input().split()]
A = []

if N > 1:
  for n in range(N-1):
    a = abs(x[n] - x[n+1])
    A.append(a)

  D = functools.reduce(math.gcd, A)
else:
  D = x[0] - X
print(D)

Fixed submission:
from fractions import gcd
from functools import reduce

n,x = map(int, input().split())
X = [int(i) for i in input().split()]
X = [abs(x-j) for j in X]
ans = reduce(gcd, X)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ans = 0
if K % 2 != 0:
    M = [a for a in range(0, N+1, K)]
    M.pop(0)
else:
    M = [a for a in range(0, N+1, K//2)]
    M.pop(0)
for a in M:
    for b in M:
        if (a + b) % K != 0:
            continue
        for c in M:
            if ((a + c) % K != 0) or ((b + c ) % K != 0):
                continue
            ans += 1
print(ans)

Fixed submission:
N, K = map(int, input().split())
ans = 0
M1 = []
M2 = []
M1 = [a for a in range(N+1) if a % K == 0]
M1.pop(0)
if K % 2 == 0:
    M2 = [a for a in range(N+1) if a % K == K//2]
print(len(M1)**3 + len(M2)**3)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ans = 0
if K % 2 != 0:
    M = [a for a in range(0, N+1, K)]
    M.pop(0)
else:
    M = [a for a in range(0, N+1, K//2)]
    M.pop(0)
for a in M:
    for b in M:
        for c in M:
            if ((a+b)%K) == ((b+c)%K) == ((c+a)%K) == 0:
                ans += 1
print(ans)

Fixed submission:
N, K = map(int, input().split())
ans = 0
M1 = []
M2 = []
M1 = [a for a in range(N+1) if a % K == 0]
M1.pop(0)
if K % 2 == 0:
    M2 = [a for a in range(N+1) if a % K == K//2]
print(len(M1)**3 + len(M2)**3)
Buggy python submission (verdict: Runtime Error):
h,w = map(int, input().split())
a = [input() for _ in range(4)]

r = [False] * h
c = [False] * w

for i in range(h):
  for j in range(w):
    if a[i][j] == "#":
      r[i] = True
      c[j] = True

for i in range(h):
  if r[i]:
    for j in range(w):
      if c[j]:
        print(a[i][j], end="")
    print()

Fixed submission:
h,w = map(int, input().split())
a = [input() for _ in range(h)]

r = [False] * h
c = [False] * w

for i in range(h):
  for j in range(w):
    if a[i][j] == "#":
      r[i] = True
      c[j] = True

for i in range(h):
  if r[i]:
    for j in range(w):
      if c[j]:
        print(a[i][j], end="")
    print()

Buggy python submission (verdict: Runtime Error):
h,w = map(int, input().split())
a = [input() for _ in range(4)]

r = [False] * h
c = [False] * w

for i in range(h):
  for j in range(w):
    if a[i][j] == "#":
      r[i] = True
      c[j] = True

for i in range(h):
  if r[i]:
    for j in range(w):
      if c[j]:
        print("{}".format(a[i][j]), end="")
    print()

Fixed submission:
h,w = map(int, input().split())
a = [input() for _ in range(h)]

r = [False] * h
c = [False] * w

for i in range(h):
  for j in range(w):
    if a[i][j] == "#":
      r[i] = True
      c[j] = True

for i in range(h):
  if r[i]:
    for j in range(w):
      if c[j]:
        print(a[i][j], end="")
    print()
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
​
for i in range(1,26):
  for j in range(1,15):
    n = 4*i + 7*j
    if n == N:
      ans = 1
      break
      
if ans == 1:
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
ans = 0

for i in range(26):
  for j in range(15):
    n = 4*i + 7*j
    if n == N:
      ans = 1
      break
  if ans == 1:
    break

if ans == 1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import gcd


N = int(input())
A = [int(a) for a in input().split()]
def lcm(a,b):
    return (a*b//gcd(a, b))
def lcmm(l):
    return reduce(lcm, l)

m = lcmm(A) - 1
print(sum([m%a for a in A]))

Fixed submission:
from functools import reduce
from fractions import gcd

N = int(input())
A = [int(a) for a in input().split()]
def lcm(a,b):
    return (a*b//gcd(a, b))
def lcmm(l):
    return reduce(lcm, l)

m = lcmm(A) - 1
print(sum([m%a for a in A]))
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int, input().split())
X = list(range(A,B+1))

for _ in sorted(set(X[:K]) | set(X[-K:])):
  print(_)

Fixed submission:
A,B,K = map(int, input().split())
X = range(A,B+1)

for _ in sorted(set(X[:K]) | set(X[-K:])):
  print(_)

Buggy python submission (verdict: Runtime Error):
A,B,K = map(int, input().split())
X = list(range(A,B+1))
ans = X[:K] + X[-K:]

for _ in sorted(set(ans)):
  print(_)

Fixed submission:
A,B,K = map(int, input().split())
X = range(A,B+1)

for _ in sorted(set(X[:K]) | set(X[-K:])):
  print(_)

Buggy python submission (verdict: Runtime Error):
A,B,K = map(int, input().split())
X = list(range(A,B+1))
ans = X[:K] + X[-K:]

for _ in set(ans):
  print(_)

Fixed submission:
A,B,K = map(int, input().split())
X = range(A,B+1)

for _ in sorted(set(X[:K]) | set(X[-K:])):
  print(_)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from itertools import product
import sys
read = sys.stdin.buffer.read


C = np.array(read().split(), np.int32).reshape(3, 3)
i, j, k = np.max(C + 1, axis=1)
flag = 0
for i, j, k in product(range(i), range(j), range(k)):
    x = C[0, :] - i
    y = C[1, :] - j
    z = C[2, :] - k

    if np.all((x == y) & (y == z)):
        flag = 1
        break

print(['No', 'Yes'][flag])

Fixed submission:
import numpy as np
from itertools import product
import sys
read = sys.stdin.buffer.read


C = np.array(read().split(), np.int32).reshape(3, 3)

a, b, c = np.max(C + 1, axis=1)
N = []
for i, j in product(range(a), range(b)):
    x = C[0, :] - i
    y = C[1, :] - j

    if np.all(x == y):
        N.append(x)

flag = 0
z = C[2, :]
for n in N:
    for k in range(c):
        if np.all(z - k == n):
            flag = 1
            break
    
    if flag:
        break

print(['No', 'Yes'][flag])
Buggy python submission (verdict: Runtime Error):
import math
print(int(math.sqrt(int(input()))) ** 2

Fixed submission:
import math
print(int(math.sqrt(int(input()))) ** 2)
Buggy python submission (verdict: Runtime Error):
from collections import Counter


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

nc = Counter(A)
C = []
for i in range(1, max(A)):
    c = nc[i - 1] + nc[i] + nc[i + 1]
    C.append(c)

print(max(C))

Fixed submission:
from collections import Counter


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

nc = Counter(A)
C = []
for i in range(max(A) + 1):
    c = nc[i - 1] + nc[i] + nc[i + 1]
    C.append(c)

print(max(C))

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


N = int(input())
A = np.array(list(map(int, input().split())))
ans = []
for x in range(10 ** 5 + 1):
    c = np.sum((A >= (x - 1)) & (A <= (x + 1)))
    ans.append(c)

print(max(ans))

Fixed submission:
from collections import Counter


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

nc = Counter(A)
C = []
for i in range(max(A) + 1):
    c = nc[i - 1] + nc[i] + nc[i + 1]
    C.append(c)

print(max(C))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(a) for a in input().split()]
B = deque([])
for n in range(N):
    if n % 2 == 0:
        B.append(A[n])
    else:
        B.appendleft(A[n])
print(*B)

Fixed submission:
from collections import deque

N = int(input())
A = [int(a) for a in input().split()]
B = deque([])
for n in range(N):
    if n % 2 == 0:
        B.append(A[n])
    else:
        B.appendleft(A[n])
if N % 2 == 0:
    print(*B)
else:
    print(*list(B)[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(a) for a in input().split()]
B = []
for n in range(N):
    if n % 2 == 0:
        B.append(A[n])
    else:
        B.insert(0, A[n])
if N % 2 == 0:
    print(*B)
else:
    print(*B[::-1])

Fixed submission:
from collections import deque

N = int(input())
A = [int(a) for a in input().split()]
B = deque([])
for n in range(N):
    if n % 2 == 0:
        B.append(A[n])
    else:
        B.appendleft(A[n])
if N % 2 == 0:
    print(*B)
else:
    print(*list(B)[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(a) for a in input().split()]
B = []
for n in range(N):
    B.append(A[n])
    B = B[::-1]
print(*B)

Fixed submission:
from collections import deque

N = int(input())
A = [int(a) for a in input().split()]
B = deque([])
for n in range(N):
    if n % 2 == 0:
        B.append(A[n])
    else:
        B.appendleft(A[n])
if N % 2 == 0:
    print(*B)
else:
    print(*list(B)[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(a) for a in input().split()]
B = []
for n in range(N):
    B.append(A[n])
    B.reverse()
print(*B)

Fixed submission:
from collections import deque

N = int(input())
A = [int(a) for a in input().split()]
B = deque([])
for n in range(N):
    if n % 2 == 0:
        B.append(A[n])
    else:
        B.appendleft(A[n])
if N % 2 == 0:
    print(*B)
else:
    print(*list(B)[::-1])