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

Fixed submission:
from fractions import gcd

d = gcd(*map(int, input().split()))
r = 1
i = 2
while i * i <= d:
    if d % i == 0:
        d //= i
        r += 1
    while d % i == 0:
        d //= i
    i += 1
print(r + (d > 1))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
 
d = gcd(*map(int, input().split()))
r = 1
i = 2
while i * i <= d:
    r += d % i == 0:
    while d % i == 0:
        d //= i
    i += 1
print(r + (d > 1))

Buggy submission (verdict: Runtime Error):
import math

d = math.gcd(*map(int, input().split()))
r = 1
i = 2
while i * i <= d:
    if d % i == 0:
        d //= i
        r += 1
    while d % i == 0:
        d //= i
    i += 1
print(r + (d > 1))
Problem p02928 (python)

Fixed submission:
from collections import Counter
R = lambda: map(int, input().split())
n, k = R()
a = list(R())
r = k * sum(a[i] < a[j] for i in range(n) for j in range(i))
r = n*(n-1)//2 - sum(x*(x-1)//2 for x in Counter(a).values())
r = r * k*(k-1)//2 + k * sum(a[i] < a[j] for i in range(n) for j in range(i))
print(r % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
from itertools import groupby

R = lambda: map(int, input().split())
n, k = R()
a = list(R())
w = [0] * n

def merge(b, e):
    m = b + (e - b) // 2
    i, j = b, m
    r = 0
    while i < m and j < e:
        if a[i] <= a[j]:
            w[i + j] = a[i]
            i += 1
        else:
            r += m - i
            w[i + j] = a[j]
            j += 1
    a[e - m + i: e] = a[i: m]
    a[b: b + i + j] = w[:i + j]
    return r        
    
def mergesort(b, e):
    if e - b < 2:
        return 0
    mid = b + (e - b) // 2
    return mergesort(b, mid) + mergesort(mid, e) + merge(b, e)


r = k * mergesort(0, n)
print(a)
c = n * (n - 1) // 2
for _, g in groupby(a):
    x = sum(1 for _ in g)
    c -= x * (x - 1) // 2
print((r + c * k * (k - 1) // 2) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
from itertools import groupby

R = lambda: map(int, input().split())
n, k = R()
a = list(R())
w = [0] * n

def merge(b, e):
    m = b + (e - b) // 2
    i, j = b, mid
    r = 0
    while i < m and j < e:
        if a[i] <= a[j]:
            w[i + j] = a[i]
            i += 1
        else:
            r += m - i
            w[i + j] = a[j]
            j += 1
    a[e - m + i: e] = a[i: m]
    a[b: b + i + j] = w[:i + j]
    return r        
    
def mergesort(b, e):
    if e - b < 2:
        return 0
    mid = b + (e - b) // 2
    return mergesort(b, mid) + mergesort(mid, e) + merge(b, e)


r = k * mergesort(0, n)
print(a)
c = n * (n - 1) // 2
for _, g in groupby(a):
    x = sum(1 for _ in g)
    c -= x * (x - 1) // 2
print((r + c * k * (k - 1) // 2) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
from itertools import groupby

R = lambda: map(int, input().split())
n, k = R()
a = list(R())
w = [0] * n

def merge(b, e):
    m = b + (e - b) // 2
    i, j = b, mid
    r = 0
    while i < m and j < e:
        if a[i] <= a[j]:
            w[i + j] = a[i]
            i += 1
        else:
            r += m - i
            w[i + j] = a[j]
            j += 1
    a[e - m + i: e] = a[i: m]
    a[b: b + i + j] = w[:i + j]
    return r        
    
def mergesort(b, e):
    if e - b < 2:
        return 0
    mid = b + (e - b) // 2
    return mergesort(b, mid) + mergesort(mid, e) + merge(b, e)


r = k * mergesort(0, n)
print(a)
c = n * (n - 1) // 2
for _, g in groupby(a):
    x = sum(1 for _ in g)
    c -= x * (x - 1) // 2
print((r + c * k * (k - 1) // 2) % (10**9 + 7))
Problem p02960 (python)

Fixed submission:
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    r = range(10) if c == '?' else (int(c),)
    a = [sum(a[(i - p * j) % 13] for j in r) % M for i in range(13)]
    p = p * 10 % 13
print(a[5])

Buggy submission (verdict: Runtime Error):
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input())):
    r = range(0, p * 10, p) if c == '?' else (p * int(c),)
    a = [sum(a[(i - j) % 13] for j in r) % M for i in range(13)]
    p = p * 10 % 13
print(a[5])

Buggy submission (verdict: Runtime Error):
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    r = [x % 13 for x in range(0, p * 10, p)] if c == '?' else (p * int(c),)
    a = [sum(a[(i - j, i - j + 13)[i < j]] for j in r) % M for i in range(13)]
    p = p * 10 % 13
print(a[5])

Buggy submission (verdict: Runtime Error):
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    r = (0, p * 10) if c == '?' else (int(c), int(c) + 1)
    a = [sum(a[(i - j) % 13] for j in range(*r, p)) % M for i in range(13)]
    p = p * 10 % 13
print(a[5])

Buggy submission (verdict: Runtime Error):
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    r = range(0, p * 10, p) if c == '?' else (p * int(c),)
    if c != '?':
      a = [a[i - p * int(c)] for i in range(13)]
    else:
      a = [sum(a[(i - j) % 13] for j in range(0, p * 10, p)) % M for i in range(13)] 
    p = p * 10 % 13
print(a[5])
Problem p02972 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
r = [None] * (n + 1)
for i in range(n, 0, -1):
    r[i] = (a[i - 1] + sum(r[i * 2::i])) % 2
print(r.count(1))
print(*(i for i, x in enumerate(r) if x))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input()
r = [None] * (n + 1)
for i in range(n, 0, -1):
    r[i] = (ord(a[2 * i - 1]) + sum(r[i * 2::i])) % 2
print(r.count(1))
print(*(i for i, x in enumerate(r) if x))
Problem p02975 (python)

Fixed submission:
R = lambda: map(int, input().split())

n = int(input())
if n % 3:
    ans = 'YNeos'[any(R())::2]
else:
    a = sorted(map(int, input().split()))
    m = n // 3
    if a[0] ^ a[m] ^ a[2 * m]:
        ans = 'No'
    elif any(len(set(a[i:i + m])) > 1 for i in range(0, n, m)):
        ans = 'No'
    else:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from operator import xor

R = lambda: map(int, input().split())
 
n = int(input())
if n % 3:
    ans = 'YNeos'[any(R())::2]
else:
    a = sorted(R())
    m = n // 3
    if reduce(a[::m], xor):
        ans = 'No'
    elif any(len(set(a[i:i + m])) > 1 for i in range(0, n, m)):
        ans = 'No'
    else:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 3:
    ans = 'No'
else:
    a = sorted(map(int, input().split()))
    m = n // 3
    if a[0] ^ a[m] ^ a[2 * m]:
        ans = 'No'
    elif any(x != y for i, x, y in enumerate(zip(a, a[1:]), 1) if i % m):
        ans = 'No'
    else:
        ans = 'Yes'
print(ans)
Problem p02983 (python)

Fixed submission:
l, r = map(int, input().split())
if r // 3 > (l - 1) // 3 and r // 673 > (l - 1) // 673:
    print(0)
else:
    print(min(i * j % 2019 for i in range(l, r + 1) for j in range(l, i)))

Buggy submission (verdict: Runtime Error):
l, r = map(int, input().split())
if  r - l >= 672:
    print(0)
else:
    print(min(i * j % 2019 for i in range(l, r + 1) for j in range(l, ir)))
Problem p02996 (python)

Fixed submission:
from itertools import accumulate

n = int(input())
a = sorted(tuple(map(int, input().split()))[::-1] for _ in range(n))
c, d = zip(*a)
print('YNeos'[any(x < y for x, y in zip(c, accumulate(d)))::2])

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
from itertools import accumulate
 
n = int(input())
a = (tuple(map(int, input().split())) for _ in range(n))
c, d = (map(itemgetter(i), sorted(a, key=itemgetter(1)) for i in (0, 1))
print('YNeos'[any(x > y for x, y in zip(accumulate(c), d))::2])

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
from itertools import accumulate
 
n = int(input())
a = sorted(tuple(map(int, reversed(input().split())) for _ in range(n)))
c, d = (map(itemgetter(i), a) for i in (0, 1))
print('YNeos'[any(x < y for x, y in zip(c, accumulate(d)))::2])
Problem p03006 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]
c = Counter((y[0] - x[0], y[1] - x[1]) for x in a for y in a if x < y)
print(n - max(c.values(), default=0))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]
c = Counter((y[0] - x[0], y[1] - x[1]) for i, x in enumerate(a) for y in a[:i])
print(n - max(c.values()))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]
c = Counter((y[0] - x[0], y[1] - x[1]) for x in a for y in a if x < y)
print(n - max(c.values()))
Problem p03032 (python)

Fixed submission:
import heapq
from itertools import chain

R = lambda: map(int, input().split())
n, k = R()
v = list(R())
r = 0
for i in range(1, min(n, k) + 1):
    for j in range(i):
        s = 0
        h = []
        for m in chain(range(i - j), range(n - j, n)):
            x = v[m]
            s += x
            if x < 0:
                heapq.heappush(h, x)
        j = i
        while h and j < k:
            s -= heapq.heappop(h)
            j += 1
        r = max(r, s)
print(r)

Buggy submission (verdict: Runtime Error):
from itertools import islice
 
R = lambda: map(int, input().split())
n, k = R()
v = list(R())
a = sorted((x, i) for i, x in enumerate(v) if x < 0)
ans = max(sum(v[:i - j] + v[n - j:])) -
          sum(islice((x for x, m in a if m < i - j or m >= n - j), k - i))
          for i in range(1, min(n, k) + 1) for j in range(i))
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
from itertools import chain

R = lambda: map(int, input().split())
n, k = R()
v = list(R())
r = 0
for i in range(min(n, k)):
    for j in range(i):
        s = 0
        h = []
        for m in chain(range(i - j), range(n - j, n)):
            x = v[m]
            s += x
            if x < 0:
                heapq.heappush(h, x)
        while h and i < k:
            s -= heapq.heappop(h)
            i += 1
        r = max(r, s)
print(r)
Problem p03061 (python)

Fixed submission:
from fractions import gcd
from itertools import accumulate

input()
a = list(map(int, input().split()))
b = list(accumulate(a, gcd))
c = list(accumulate(reversed(a), gcd))
print(max(b[-2], c[-2], *map(gcd, b[:-2], c[-3::-1])))

Buggy submission (verdict: Runtime Error):
from math import gcd
from itertools import accumulate

input()
a = list(map(int, input().split()))
b = list(accumulate(a, gcd))
c = list(accumulate(reversed(a), gcd))
b = [c[-2]] + b
c = [b[-2]] + c
print(max(map(gcd, b, c[-2::-1])))

Buggy submission (verdict: Runtime Error):
from math import gcd
from itertools import accumulate

input()
a = list(map(int, input().split()))
b = list(accumulate(a, gcd))
c = list(accumulate(reversed(a), gcd))
print(max(b[-2], c[-2], *map(gcd, b[:-2], c[-3::-1])))
Problem p03067 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(('No', 'Yes')[a < c < b or a > c > b])

Buggy submission (verdict: Runtime Error):
from itertools import accumulate

input()
l = [0] + list(accumulate(c == '.' for c in input()))
print(min(i - x + l[-1] - x for i, x in enumerate(l)))
Problem p03069 (python)

Fixed submission:
from itertools import accumulate
 
input()
l = [0] + list(accumulate(c == '.' for c in input()))
print(min(i - x + l[-1] - x for i, x in enumerate(l)))

Buggy submission (verdict: Runtime Error):
from itertools import accumulate

input()
l = [0, *accumulate(c == '.' for c in input())]
print(min(i - x + l[-1] - x for i, x in enumerate(l)))
Problem p03086 (python)

Fixed submission:
p = 'ACGT'
s = input()
l = len(s)
r = 0
i = -1
while i < l:
 i = next((i for i in range(i + 1, l) if s[i] in p), l)
 j = next((i for i in range(i + 1, l) if s[i] not in p), l)
 r = max(r, j - i)
 i = j
print(r)

Buggy submission (verdict: Runtime Error):
import re
print(max(map(len,re.finditer('[ACGT]*',input()))))

Buggy submission (verdict: Runtime Error):
import re
print(max(len(x[0]) for x in re.finditer('[ACGT]*',input())))
Problem p02606 (python)

Fixed submission:
l,r,d = map(int,input().split())
result = 0
for i in range(l, r+1):
  if i % d == 0:
    result+= 1
print(result)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
for i in range(1,n+1):
  max = int(math.sqrt(i))
  result = 0
  for x in range(1,max+1):
    for y in range(1,max+1):
      for z in range(1,max+1):
        if x * x + y * y + z * z + x * y + y * z + x * z == i:
          result += 1
  print(result)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
for i in range(1,n+1):
  max = int(math.sqrt(i))
  result = 0
  for x in range(1,max):
    for y in range(1,max):
      for z in range(1,max):
        if x * x + y * y + z * z + x * y + y * z + x * z == i:
          result += 1
  print(result)
Problem p02630 (python)

Fixed submission:
N = int(input())
A= list(map(int,input().split()))
Q = int(input())
heavy = [0] * (10 ** 5 + 1)
for i in A:
  heavy[i] += 1
s = sum(A)
for i in range(Q):
  be,af = map(int,input().split())
  s -= be * heavy[be]
  s += af * heavy[be]
  heavy[af] += heavy[be]
  heavy[be] = 0
  print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
l= list(map(int,input().split()))
c = [0] * 10001
for i in l:
  c[i] += 1
n = int(input())
s = sum(c)
for i in range(n):
  be,af = map(int,input().split())
  s -= be * c[be]
  s += af * c[be]
  c[af] += c[be]
  c[be] = 0
  print(s)

Buggy submission (verdict: Runtime Error):
def csum(c):
  r = 0
  for index, item in enumerate(c):
    r += index * item
  return r

n = int(input())
l= list(map(int,input().split()))
c = [0] * 10001
for i in l:
  c[i] += 1
n = int(input())
s = csum(c)
for i in range(0, n):
  be,af = map(int,input().split())
  s -= be * c[be]
  s += af * c[be]
  c[af] += c[be]
  c[be] = 0
  print(s)

Buggy submission (verdict: Runtime Error):
def csum(c):
  r = 0
  for index, item in enumerate(c):
    r += index * item
  return r

n = int(input())
l= list(map(int,input().split()))
c = [0] * 10001
for i in l:
  c[i] += 1
n = int(input())
for i in range(0, n):
  be,af = map(int,input().split())
  c[af] += c[be]
  c[be] = 0
  print(csum(c))
Problem p02639 (python)

Fixed submission:
li = list(map(int,input().split()))
for i, j in enumerate(li):
  if j == 0:
    print(i + 1)

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
for i, j in enumerate(li):
  if j == 0:
    echo i + 1
Problem p02640 (python)

Fixed submission:
x,y = map(int,input().split())
 
for i in range(x+1):
  if 2 * i + 4 * (x - i) == y:
    print('Yes')
    exit()
print('No')

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())

for i in range(x):
  if 2 * i + 4 * (x - i) == y:
    print('Yes')
    sys.exit()
print('No')
Problem p02675 (python)

Fixed submission:
a = list(input())
ai = int(a[-1])
if [2,4,5,7,9].count(ai) > 0:
  print('hon')
if [0,1,6,8].count(ai) > 0:
  print('pon')
if [3].count(ai) > 0:
  print('bon')

Buggy submission (verdict: Runtime Error):
a = list(input())
ai = int(a[-1])
if [2,4,5,7,9].includes(ai):
  print('hon')
if [0,1,6,8].includes(ai):
  print('pon')
if [3].includes(ai):
  print('bon')
Problem p02683 (python)

Fixed submission:
n,m,x = map(int,input().split())
c = []
a = []
for i in range(n):
  l = list(map(int,input().split()))
  c.append(l[0])
  a.append(l[1:])
result = -1
for i in range(2 ** n):
  ct = 0
  at = [0] * m
  for b in range(0, n):
    bb = 1 << b 
    if i & bb > 0:
      ct += c[b]
      for j in range(0, m):
        at[j] += a[b][j]
  if result == -1 or ct < result:
    r = 1
    for ati in at:
      if ati < x:
        r = 0
    if r == 1:
      result = ct
print(result)

Buggy submission (verdict: Runtime Error):
n,m,x = map(int,input().split())
for i in range(n):
  c.append(list(map(int,input().split())))
print(c)
result = -1
for i in range(2 ** n):
  ct = 0
  t = [0] * m
  for b in range(1, n + 1):
    if i & b > 0:
      ct += c[b - 1][0]
      for j in range(1, m + 1):
        t[j - 1] += c[b - 1][j]
  if result == -1 or ct < result:
    r = 1
    for ti in t:
      if ti < x:
        r = 0
    if r == 1:
      print(ct)
      print(t)
      result = ct
print(result)
Problem p02687 (python)

Fixed submission:
N = input()
ans = 'ABC' if N == 'ARC' else 'ARC'
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
print 'ABC' if N == 'ARC' else print 'ARC'
Problem p03102 (python)

Fixed submission:
N, M, C = map(int, input().split())                                                                                                                         
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range(N):
    S[i] = list(map(int, input().split()))
  
b = 0
  
for i in range(N):
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
print(str(b))

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())                                                                                                                         
  2 B = list(map(int, input().split()))
  3  
  4 S = [[0]*M for i in range(N)]
  5 for i in range(N):
  6     S[i] = list(map(int, input().split()))
  7  
  8 b = 0
  9  
 10 for i in range(N):
 11     a = 0
 12     for ii in range(M):
 13         a += S[i][ii] * B[ii]
 14     a += C
 15     if a > 0:
 16         b += 1
 17  
 18 print(str(b))

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
  2 B = list(map(int, input().split()))
  3  
  4 S = [[0]*M for i in range(N)]
  5 for i in range(N):                                                                                                                                          
  6     S[i] = list(map(int, input().split()))
  7  
  8 b = 0
  9  
 10 for i in range(N):
 11     a = 0
 12     for ii in range(M):
 13         a += S[i][ii] * B[ii]
 14     a += C
 15     if a > 0:
 16         b += 1
 17  
 18 print(str(b))
Problem p03469 (python)

Fixed submission:
S = str(input())

print(S.replace('7', '8', 1))

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())

a = 0

for i in range(N):
    for ii in range(N):
        for iii in range(N):
            ans = 10000 * i + 5000 * ii + 1000 * iii
            J = i + ii + iii
            if ans == Y and J == N:
                print(i,ii,iii)
                a += 1
                break
        if a != 0:
            break
    if a != 0:
        break

if a == 0:
    print(-1,-1,-1)
Problem p03597 (python)

Fixed submission:
N = int(input())                                                                                                                                            
A = int(input())
  
ans = (N * N) - A
  
print(str(ans))

Buggy submission (verdict: Runtime Error):
def solve():


    A, B, C, D, E, F = map(int, input().split())

    #memo
    list = {}

    #操作1-4
    ope1 = 100 * A
    ope2 = 100 * B
    ope3 = C
    ope4 = D


    for i in range(31):
        for j in range(31):
            for k in range(101):
                for l in range(101):
                    w_sum = i * ope1 + j * ope2
                    s_sum = k * ope3 + l * ope4
                    if w_sum == 0:
                        break
                    if w_sum+s_sum > F:
                        break
                    else:
                        if w_sum/100 * E >= s_sum:
                            p_tmp = (s_sum / (w_sum + s_sum)) * 100
                            list[i, j, k, l] = p_tmp

    max_v = max(list.values())

    for k, v in list.items():
        if v == max_v:
            print(ope1*k[0] + ope2*k[1] + ope3*k[2] + ope4*k[3], ope3*k[2] + ope4*k[3])

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())

#memo
list = [0, 0]

#操作1-4
ope1 = 100 * A
ope2 = 100 * B
ope3 = C
ope4 = D
#入れた水、砂糖の総量
w_sum = 0
s_sum = 0
#パーセンテージ
p = 0
#トータル
total = w_sum + s_sum
#砂糖の表示用の変数
s = 0

for i in range(101):
    for j in range(101):
        for k in range(31):
            for l in range(31):
                w_sum = l * ope1 + k * ope2
                s_sum = j * ope3 + i * ope4
                if w_sum != 0 and w_sum + s_sum <= F and s_sum <= E * (l + k) :
                    p_tmp = (s_sum / (w_sum + s_sum)) * 100
                    if p_tmp >= p:
                        p = p_tmp
                        list[0] = w_sum + s_sum
                        list[1] = s_sum

print(list[0], list[1])

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())

#memo
list = [0, 0]

#操作1-4
ope1 = 100 * A
ope2 = 100 * B
ope3 = C
ope4 = D
#入れた水、砂糖の総量
w_sum = 0
s_sum = 0
#パーセンテージ
p = 0
#トータル
total = w_sum + s_sum
#砂糖の表示用の変数
s = 0

for i in range(101):
    for j in range(101):
        for k in range(31):
            for l in range(31):
                w_sum = l * ope1 + k * ope2
                s_sum = j * ope3 + i * ope4
                if w_sum != 0 and w_sum + s_sum <= F and s_sum <= E * (l + k) :
                    p_tmp = (s_sum / (w_sum + s_sum)) * 100
                    if p_tmp >= p:
                        p = p_tmp
                        list[0] = w_sum + s_sum
                        list[1] = s_sum

print(list[0], list[1])
Problem p03611 (python)

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

    lists = [0] * ((10**5)+2)

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

    print(max(lists))    

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    
    N = int(input())
    a  = list(map(int, input().split()))

    lists = [0] * ((10**5)+2)

    for i in range(a):
        lists[v] += 1
        lists[v+1] += 1
        lists[v-1] += 1

    print(max(lists))    

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    
    N = int(input())
    a  = list(map(int, input().split()))

    lists = [0] * ((10**5)+2)

    for i in range(a):
        lists[v] += 1
        lists[v+1] += 1
        lists[v-1] += 1

    print(max(lists))    

if __name__ = "__main__":
    solve()