Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
v1, v2 = v[::2], [1::2]
vv1 = Counter(v1).most_common()
vv2 = Counter(v2).most_common()

if len(set(v)) == 1:
    print(n//2)
if vv1[0] != vv2[0]:
    print(n - vv1[0][1] - vv2[0][1])
else:
    print(n - max(vv1[1][1] + vv2[0][1], vv1[0][1] + vv2[1][1]))

Fixed submission:
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
v1, v2 = [], []
for i in range(n):
    if i%2:
        v1.append(v[i])
    else:
        v2.append(v[i])
vv1 = Counter(v1).most_common()
vv2 = Counter(v2).most_common()
if vv1[0] != vv2[0]:
    print(n - vv1[0][1] - vv2[0][1])
else:
    if len(vv1) == len(vv2) == 1:
        print(n - max(vv1[0][1], vv2[0][1]))
    elif len(vv1) == 1 and len(vv2) == 2:
        print(n - vv1[0][1] - vv2[1][1])
    elif len(vv1) == 2 and len(vv2) == 1:
        print(n - vv1[1][1] - vv2[0][1])
    else:
        print(n - max(vv1[1][1] + vv2[0][1], vv1[0][1] + vv2[1][1]))

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
v1, v2 = [], []
for i in range(n):
    if i%2:
        v1.append(v[i])
    else:
        v2.append(v[i])
vv1 = Counter(v1).most_common()
vv2 = Counter(v2).most_common()
if vv1[0] != vv2[0]:
    print(n - vv1[0][1] - vv2[0][1])
else:
    if -(-n)//2 - vv1[0][1] < n//2 - vv2[0][1]:
        print(n - vv1[0][1] - vv2[1][1])
    else:
        print(n - vv1[1][1] - vv2[0][1])

Fixed submission:
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
v1, v2 = [], []
for i in range(n):
    if i%2:
        v1.append(v[i])
    else:
        v2.append(v[i])
vv1 = Counter(v1).most_common()
vv2 = Counter(v2).most_common()
if vv1[0] != vv2[0]:
    print(n - vv1[0][1] - vv2[0][1])
else:
    if len(vv1) == len(vv2) == 1:
        print(n - max(vv1[0][1], vv2[0][1]))
    elif len(vv1) == 1 and len(vv2) == 2:
        print(n - vv1[0][1] - vv2[1][1])
    elif len(vv1) == 2 and len(vv2) == 1:
        print(n - vv1[1][1] - vv2[0][1])
    else:
        print(n - max(vv1[1][1] + vv2[0][1], vv1[0][1] + vv2[1][1]))
Buggy python submission (verdict: Runtime Error):
n = list(map(int, input().split()))
n.reverse()
print('n[0]n[1]' +[2])

Fixed submission:
n = list(map(int, input().split()))
n.sort()
print(n[2]*10 + n[1] + n[0])
Buggy python submission (verdict: Time Limit Exceeded):
import sys


def main():
    s = input()
    t = input()
    for i in range(len(s)):
        if s[i] != t[i]:
            s = s.translate(str.maketrans({s[i]: t[i], t[i]: s[i]}))
    if s == t:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from collections import Counter


def main():
    s = input()
    t = input()
    s_count = [0]*26
    t_count = [0]*26
    for i in range(ord("a"), ord("z")+1):
        s_count[i-97] = s.count(chr(i))
        t_count[i-97] = t.count(chr(i))
    s_count.sort()
    t_count.sort()
    if s_count == t_count:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
a , b = map(int, input().split())
if (a * b %% 2 == 1) :
  print("Yes")
else:
  print("No")

Fixed submission:
a , b = map(int, input().split())
if (a * b % 2 == 1) :
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, m - map(int, input().split())
print((n - 1) * (m - 1))

Fixed submission:
n, m = map(int, input().split())
print((n - 1) * (m - 1))
Buggy python submission (verdict: Runtime Error):
n = int(input())
flag = 0
for i in range(15):
  for j in range(26):
    if 7*i + 4*j == n:
      flag = 1
      exit

if flag == 1:
  print("Yes")
else :
  print("No")

Fixed submission:
n, k = map(int, input().split())
if n%k != 0:
  print((n//k)+1 - (n//k))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(15):
  for j in range(26):
    if 7*i + 4*j == n
      print("Yes")
      exit 
print("No")

Fixed submission:
n = int(input())
flag = 0
for i in range(15):
  for j in range(26):
    if 7*i + 4*j == n:
      flag = 1
      exit

if flag == 1:
  print("Yes")
else :
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(15):
  for j in range(26):
    if 7*i + 4*j == n
      print("Yes")
      exit
      
print(No)

Fixed submission:
n = int(input())
flag = 0
for i in range(15):
  for j in range(26):
    if 7*i + 4*j == n:
      flag = 1
      exit

if flag == 1:
  print("Yes")
else :
  print("No")
Buggy python submission (verdict: Runtime Error):
print("Yes" for input() in input()*2 else "No")  

Fixed submission:
print("Yes" if input() in input()*2 else "No")
Buggy python submission (verdict: Runtime Error):
n = int(input)
if n%2 == 0:
  print(n)
else:
  print(2*n)

Fixed submission:
n = int(input())
if n%2 == 0:
  print(n)
else:
  print(2*n)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 10**10
for i in range(n):
    tmp = s[:i].count('W') + s[i+1:].count('E')
    if tmp < ans:
        ans = tmp
print(ans)


Fixed submission:
n = int(input())
s = input()
l = 0
r = s[1:].count('E')
ans = l + r

for i in range(1, n):
    if s[i-1] == 'W':
        l += 1
    if s[i] == 'E':
        r -= 1
    if l + r < ans:
        ans = l + r
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

acc = [0 for i in range(n+1)]
for i in range(n):
    acc[i+1] = a[i] + acc[i]

ans = [0 for i in range(n+1)]
for i in range(n+1):
    ans[acc[i]] += 1

cnt = 0
for i in range(len(a)+1):
    cnt += ans[i]*(ans[i]-1)//2

print(cnt)

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

acc = [0 for i in range(n+1)]
for i in range(n):
    acc[i+1] = a[i] + acc[i]

ans = {}
for x in acc:
    ans.setdefault(x, 0)
    ans[x] += 1
cnt = 0
for i in ans:
    cnt += ans[i]*(ans[i]-1)//2

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(len(a)):
  for j in range(i,len(a)):
    if sum(a[t] for t in range(i,j+1)) == 0:
      cnt += 1
print(cnt)

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

acc = [0 for i in range(n+1)]
for i in range(n):
    acc[i+1] = a[i] + acc[i]

ans = {}
for x in acc:
    ans.setdefault(x, 0)
    ans[x] += 1
cnt = 0
for i in ans:
    cnt += ans[i]*(ans[i]-1)//2

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import copy
n = int(input())
x = list(map(int, sys.stdin.readline().split()))
y = sorted(x)
for i in x:
    tmp = copy.copy(y)
    tmp.remove(i)
    print(tmp[n//2-1])

Fixed submission:
import sys
import copy
n = int(input())
x = list(map(int, sys.stdin.readline().split()))
y = sorted(x)
for i in x:
    if y[n//2] > i:
        print(y[n//2])
    else:
        print(y[n//2-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
x = list(map(int, sys.stdin.readline().split()))
for i in range(n):
    tmp = x[:i] + x[i+1:]
    tmp.sort()
    print(tmp[n//2-1])

Fixed submission:
import sys
import copy
n = int(input())
x = list(map(int, sys.stdin.readline().split()))
y = sorted(x)
for i in x:
    if y[n//2] > i:
        print(y[n//2])
    else:
        print(y[n//2-1])
Buggy python submission (verdict: Runtime Error):
import collections
s = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"
dif = sorted(list(set(alphabet) - set(s)))
if len(dif):
    print(s + dif[0])
else:
    if reversed(alphabet) == s:
        print(-1)
    else:
        tmp = [s]
        for i in range(25):
            if s[i] == alphabet[i]:
                continue
            else:
                dif = sorted(list(set(alphabet) - set(s[:i])))
                tmp.append(s[:i-1] + dif[0])
        tmp.sort()
        print(tmp[tmp.index(s)+1])

Fixed submission:
s = input()+chr(ord("a")-1)
ans = -1
for i in range(len(s)):
    t = s[:~i]
    dif = set(map(chr,range(ord(s[~i])+1,123))) - set(t)
    if dif:
        ans = t + min(dif)
        break
print(ans)

Buggy python submission (verdict: Runtime Error):
import collections
s = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"
dif = sorted(list(set(alphabet) - set(s)))
if len(dif):
    print(s + dif[0])
else:
    if alphabet[::-1] == s:
        print(-1)
    else:
        tmp = [s]
        for i in range(25):
            if s[i] == alphabet[i]:
                continue
            else:
                tmp.append(s[:i-1] + alphabet[i])
        tmp.sort()
        print(tmp[tmp.index(s)+1])

Fixed submission:
s = input()+chr(ord("a")-1)
ans = -1
for i in range(len(s)):
    t = s[:~i]
    dif = set(map(chr,range(ord(s[~i])+1,123))) - set(t)
    if dif:
        ans = t + min(dif)
        break
print(ans)

Buggy python submission (verdict: Runtime Error):
import collections
s = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"
dif = sorted(list(set(alphabet) - set(s)))
if len(s) > 26:
    print(-1)
elif 0 < len(dif):
    if len(s) == len(set(s)):
        print(s + dif[0])
    else:
        print(-1)
else:
    if alphabet[::-1] == s:
        print(-1)
    else:
        tmp = [s]
        for i in range(25):
            if s[i] == alphabet[i]:
                continue
            else:
                tmp.append(s[:i-1] + alphabet[i])
        tmp.sort()
        print(tmp[tmp.index(s)+1])

Fixed submission:
s = input()+chr(ord("a")-1)
ans = -1
for i in range(len(s)):
    t = s[:~i]
    dif = set(map(chr,range(ord(s[~i])+1,123))) - set(t)
    if dif:
        ans = t + min(dif)
        break
print(ans)

Buggy python submission (verdict: Runtime Error):
import collections
s = input()
alphabet = "abcdefghijknmlopqrstuvwxyz"
dif = sorted(list(set(alphabet) - set(s)))
if len(dif) <= 26:
    if len(s) == len(set(s)):
        print(s + dif[0])
    else:
        print(-1)
elif len(s) > 26:
    print(-1)
else:
    if reversed(alphabet) == s:
        print(-1)
    else:
        tmp = [s]
        for i in range(25):
            if s[i] == alphabet[i]:
                continue
            else:
                tmp.append(s[:i] + alphabet[i])
        tmp.sort()
        print(tmp[tmp.index(s)-1])

Fixed submission:
s = input()+chr(ord("a")-1)
ans = -1
for i in range(len(s)):
    t = s[:~i]
    dif = set(map(chr,range(ord(s[~i])+1,123))) - set(t)
    if dif:
        ans = t + min(dif)
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b c, d = [int(input()) for i in range(4)]
print(min(a, b) + min(c, d))

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a, b) + min(c, d))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = np.array([int(i) for i in input().split()])
for i in range(n):
  ans = 0
  tmp = 0
  for j in range(n):  
    if i != j:
      ans += abs(tmp - a[j])
      tmp = a[j]
  print(ans+abs(tmp))

Fixed submission:
n = int(input())
a = [0]+[int(i) for i in input().split()]+[0]
ans = sum(abs(a[i+1] - a[i]) for i in range(n+1))
for i in range(1, n+1):
  print(ans - abs(a[i+1] - a[i]) - abs(a[i] - a[i-1]) + abs(a[i+1] - a[i-1]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
for i in range(n):
  ans = 0
  tmp = 0
  for j in range(n):  
    if i != j:
      ans += abs(tmp - a[j])
      tmp = a[j]
  print(ans+abs(tmp))

Fixed submission:
n = int(input())
a = [0]+[int(i) for i in input().split()]+[0]
ans = sum(abs(a[i+1] - a[i]) for i in range(n+1))
for i in range(1, n+1):
  print(ans - abs(a[i+1] - a[i]) - abs(a[i] - a[i-1]) + abs(a[i+1] - a[i-1]))
Buggy python submission (verdict: Runtime Error):
s = [input() for i in range(int(input()))]
t = [input() for i in range(int(input()))]
l = list(set(s))
print(max(0, max(s.count(l[i] - t.count(l[i])) for i in l)))

Fixed submission:
s = [input() for i in range(int(input()))]
t = [input() for i in range(int(input()))]
l = list(set(s))
print(max(0, max(s.count(l[i]) - t.count(l[i]) for i in range(len(l)))))

Buggy python submission (verdict: Runtime Error):
s = [input() for i in range(int(input()))]
t = [input() for i in range(int(input()))]
l = list(set(s))
  print(max(0, max(s.count(l[i] - t.count(l[i])) for i in l)))

Fixed submission:
s = [input() for i in range(int(input()))]
t = [input() for i in range(int(input()))]
l = list(set(s))
print(max(0, max(s.count(l[i]) - t.count(l[i]) for i in range(len(l)))))
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = [int(input()) for i in range(n)]
p.sort()
print(len(set(p)))

Fixed submission:
n = int(input())
d = [int(input()) for i in range(n)]
d.sort()
print(len(set(d)))
Buggy python submission (verdict: Runtime Error):
import sys

n, h = map(int, input().split())
a = [list(map(int, x.split())) for x in sys.stdin.readlines()]
a.sort(reverse=True)
b = sorted(a, key=lambda x:x[1], reverse=True)
cnt = 0
for i in b:
    if i[1] < a[0][0]:
        break
    cnt += 1
    h -= i[1]
    if h <= 0:
        print(cnt)
print(min(cnt + -(-h//a[0][0])))


Fixed submission:
import sys

n, h = map(int, input().split())
a = [list(map(int, x.split())) for x in sys.stdin.readlines()]
a.sort(reverse=True)
b = sorted(a, key=lambda x:x[1], reverse=True)
cnt = 0
for i in b:
    if i[1] < a[0][0]:
        break
    cnt += 1
    h -= i[1]
    if h <= 0:
        print(cnt)
        exit()
print(cnt + -(-h//a[0][0]))
Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
M = 10**6
p = [1 for i in range(M+1)]
p[0] = 0
p[1] = 0
for x in range(2, int(sqrt(M))+1):
    if p[x]:
        for y in range(x*x, M+1, x):
            p[y] = 0

a = [0 for i in range(M+1)]
for i in range(M):
    if i%2 != 0 and p[i] and p[(i+1)//2]:
        a[i] = 1

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(sum(a[l-1:r+1]))

Fixed submission:
from math import sqrt
M = 10**6
p = [1 for i in range(M+1)]
p[0] = 0
p[1] = 0
for x in range(2, int(sqrt(M))+1):
    if p[x]:
        for y in range(x*x, M+1, x):
            p[y] = 0

a = [0 for i in range(M+1)]
for i in range(M):
    if i%2 != 0 and p[i] and p[(i+1)//2]:
        a[i] = 1

ans = [0 for i in range(M)]
for i in range(1, M):
    ans[i] = ans[i-1] + a[i]

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(ans[r] - ans[l-1])
Buggy python submission (verdict: Runtime Error):
def main():
  n, a, b = map(int, input().split())
  cnt = 0
  for i in range(1, n+1):
    if a <= sum(map(int, list(str(i)))) <= b:
      cnt += i
  print(cnt)
  
if __name__ == '__main__':
  main()

Fixed submission:
a, b, c, d = map(int, input().split())
if a+b > c+d:
  print("Left")
elif a+b == c+d:
  print("Balanced")
else:
  print("Right")
Buggy python submission (verdict: Runtime Error):
s = input()
for i in range(len(s)):
  if s[i] == "K" ans i == 0:
    s = s[:i] + "A" + s[i:]
  elif s[i] == "H" and s[i+1] !=  "A":
    s = s[:i] + "A" + s[i:]
  elif s[i] == "B" and s[i+1] !=  "A":
    s = s[:i] + "A" + s[i:]
  elif s[i] == "R" and s[i+1] !=  "A":
    s = s[:i] + "A" + s[i:]

if s == "AKIHABARA":
  print("YES")
else:
  print("NO")

Fixed submission:
s = input()
rep = s.replace("A","")

if rep == "KIHBR" and "AA" not in s and "KIH" in s :
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
s = input()
AKB = "KIHBR"
tmp = 0
count = 0
for i in range(len(s)):
  if s[i] == "A" and count < 4:
    count += 1
  elif s[i] == AKB[tmp]:
    tmp += 1
  else:
    break

if count <= 4 and tmp == 5:
  print("YES")
else:
  print("NO")

Fixed submission:
s = input()
rep = s.replace("A","")

if rep == "KIHBR" and "AA" not in s and "KIH" in s :
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
s = input()
AKB = "KIHBR"
tmp = 0
count = 0
for i in range(len(s)):
  if s[i] == "A" and count < 4:
    count += 1
  elif s[i] == AKB[tmp]:
    tmp += 1

if count <= 4 and tmp == 5:
  print("YES")
else:
  print("NO")

Fixed submission:
s = input()
rep = s.replace("A","")

if rep == "KIHBR" and "AA" not in s and "KIH" in s :
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
s = input()
AKB = KIHBR
tmp = 0
count = 0
for i in range(len(s)):
  if s[i] == "A" and count < 4:
    count += 1
  elif s[i] == AKB[tmp]:
    tmp += 1

if count <= 4 and tmp = 5:
  print("YES")
else:
  print("NO")

Fixed submission:
s = input()
rep = s.replace("A","")

if rep == "KIHBR" and "AA" not in s and "KIH" in s :
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
a, b, c, d == input()
if a == b == c or b == c == d:
  print("Yes")
else :
  print("No")  

Fixed submission:
a, b, c, d = input()
if a == b == c or b == c == d:
  print("Yes")
else :
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from bisect import bisect

n = int(sys.stdin.buffer.readline())
a = list(map(int, sys.stdin.buffer.readline().split()))
b = list(map(int, sys.stdin.buffer.readline().split()))
c = list(map(int, sys.stdin.buffer.readline().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in a:
    for j in range(bisect(b, i), n):
        ans += n - bisect(c, b[j])
print(ans)

Fixed submission:
import sys
from bisect import bisect_left, bisect_right

n = int(sys.stdin.buffer.readline())
a = list(map(int, sys.stdin.buffer.readline().split()))
b = list(map(int, sys.stdin.buffer.readline().split()))
c = list(map(int, sys.stdin.buffer.readline().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for j in b:
    ans += (n - bisect_right(c, j))*bisect_left(a, j)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from bisect import bisect

n = int(sys.stdin.buffer.readline())
a = list(map(int, sys.stdin.buffer.readline().split()))
b = list(map(int, sys.stdin.buffer.readline().split()))
c = list(map(int, sys.stdin.buffer.readline().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in a:
    for j in range(bisect(b, i), n):
        ans += n - bisect(c, b[j])
print(ans)

Fixed submission:
import sys
from bisect import bisect_left, bisect_right

n = int(sys.stdin.buffer.readline())
a = list(map(int, sys.stdin.buffer.readline().split()))
b = list(map(int, sys.stdin.buffer.readline().split()))
c = list(map(int, sys.stdin.buffer.readline().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for j in b:
    ans += (n - bisect_right(c, j))*bisect_left(a, j)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int. input().split())
if a == b:
  print(c)
elif b == c:
  print(a)
else:
  print(b)

Fixed submission:
a, b, c = map(int, input().split())
if a == b:
  print(c)
elif b == c:
  print(a)
else:
  print(b)
Buggy python submission (verdict: Runtime Error):
def main():
  n = int(input())
  a = [[]]*n
  for i in range(n):
    a[i] = list(map(int, input().split()))

  a.sort()
  print(a[-1][0]+a[-1][1])

main()

Fixed submission:
s = input()
print(s.count("1"))
Buggy python submission (verdict: Runtime Error):
def main():
    a, b, c, d, e, f = map(int, input().split())
    sugar = 0
    water = 0
    con = 0
    for i in range(f//100+1):
        if i%b == 0 or i%a == 0:
            w = i*100
            x = min(f-w, i*e)
            s = 0
        for j in range(x//c+1):
            ss = j*c
            s = max(s, ss+((x-ss)//d)*d)
        if w != 0:
            if con <= (100*s)/(w+s):
                water = w
                sugar = s
                con = (100*s)/(w+s)
    print(sugar+water, sugar)

if __name__ == "__main__":
    main()



Fixed submission:
n = int(input())
a = int(input())
print(n**2 - a)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
ans = 0
if a == b == c and a%2 == 0:
  print(-1)
else:
  while (a%2 or b%2 or c%2) == 0 :
    tmp1 = a
    tmp2 = b
    a = b/2 + c/2
    b = tmp1/2 + c/2
    c = tmp1/2 + tmp2/2
    ans += 1
  print(ans)

Fixed submission:
n = int(input())
k = int(input())
x = list(map(int, input().split()))
ans = 0
for i in range(n):
  if 2*x[i] <= 2*(k-x[i]):
    ans += 2*x[i]
  else:
    ans += 2*(k-x[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
x, t = map(int, input().split())
if x => t:
  print(x - t)
else:
  print(0)

Fixed submission:
x, t = map(int, input().split())
if x >= t:
  print(x - t)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
def main():
  n = int(input())
  a = list(map(int, input().split()))
  ans = [0] * 10**5
  for i in a:
    ans[i] += 1
    ans[i+1] += 1
    ans[i+2] += 1
  print(max(ans))

main()

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

main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1

if p[-1] == n:
    ans += 1
print(ans)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1
if p[n-1] == n:
    ans += 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
s = intput()
s.sort()
print(s[0])

Fixed submission:
s = set(input())
ch = set([chr(ord('a') + i) for i in range(26)]) - s
if ch != set():
  ans = list(ch)
  ans.sort()
  print(ans[0])
else :
  print("None")
Buggy python submission (verdict: Runtime Error):
import collections

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

f = []
t = []
for i in a:
    if a[i] >= 4:
        f.append(i)
    if a[i] >= 2:
        t.append(i)
fa, ta = 0, 0
f.sort()
t.sort()
if len(f) >= 1:
    fa = f[-1]**2
if len(t) >= 2:
    ta = max(t[-1]*t[-2], t[-1]*f[-1])
else:
    print(0)

Fixed submission:
import sys
import collections

n = int(input())
a = collections.Counter(list(map(int, sys.stdin.readline().split())))

q = [0, 0]
for v, k in a.items():
    if k >= 4:
        q.append(v)
    if k >= 2:
        q.append(v)
q.sort()
print(q[-1]*q[-2])
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n[0] == n[2]:
  print("Yes")
else:
  print("No")

Fixed submission:
n = input()
if n[0] == n[2]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s = input()
print("s[1]" + (len(s) -2) + "s[-1]")

Fixed submission:
s = input()
print(s[0] + str(len(s) -2) + s[-1])
Buggy python submission (verdict: Runtime Error):
x, a, b = map(int, input().split())
if a-b => 0 :
  print('delicious')
elif b-a <= x:
  print('safe')
else:
  print('dangerous')


Fixed submission:
x, a, b = map(int, input().split())
if a-b >= 0 :
  print('delicious')
elif b-a <= x:
  print('safe')
else:
  print('dangerous')
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x == 2 or y == 2:
  print("No")
elif {4, 6, 9, 11} <= x and {4, 6, 9, 11} <= y:
  print("Yes")
elif {1, 3, 5, 7, 8, 10, 12} <= x and {1, 3, 5, 7, 8, 10, 12} <= y:
  print("Yes")
else :
  print("No")

Fixed submission:
x, y = map(int, input().split())
if x == 2 or y == 2:
  print("No")
elif {4, 6, 9} >= {x} and {6, 9, 11} >= {y}:
  print("Yes")
elif {1, 3, 5, 7, 8, 10} >= {x} and {3, 5, 7, 8, 10, 12} >= {y}:
  print("Yes")
else :
  print("No")