Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

cumA, cumB = [0], [0]
sa, sb = 0, 0

for a in A:
    sa += a
    cumA.append(sa)
for b in B:
    sb += b
    cumB.append(sb)

ans = 0

for i in range(N, -1, -1):
    a = cumA[i]
    if a > K:
        continue
    for j in range(M, -1, -1):
        if i + j == ans:
            break
        if a + cumB[j] <= K:
            break
    
    ans = max(i + j, ans)   

print(ans)


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

cumA, cumB = [0], [0]
sa, sb = 0, 0

for a in A:
    sa += a
    cumA.append(sa)
for b in B:
    sb += b
    cumB.append(sb)

ans = 0

for i in range(N, -1, -1):
    a = cumA[i]
    if a > K:
        continue

    b = K - a

    low = 0
    high = M

    while low <= high:
        mid = (low + high) //2
        guess = cumB[mid]
        if guess <= b:
            if mid == M:
                break
            elif cumB[mid+1] > b:
                break

        if guess > b:
            high = mid -1
        else:
            low = mid + 1

    """
    for j in range(M, -1, -1):
        if i + j == ans:
            break
        if a + cumB[j] <= K:
            break
    """
    ans = max(i + mid, ans)   

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

cumA, cumB = [0], [0]
sa, sb = 0, 0

for a in A:
    sa += a
    cumA.append(sa)
for b in B:
    sb += b
    cumB.append(sb)

ans = 0

for i in range(N+1):
    a = cumA[i]
    if a > K:
        break
    for j in range(M, -1, -1):
        if a + cumB[j] <= K:
            break
    
    ans = max(i + j, ans)    

print(ans)


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

cumA, cumB = [0], [0]
sa, sb = 0, 0

for a in A:
    sa += a
    cumA.append(sa)
for b in B:
    sb += b
    cumB.append(sb)

ans = 0

for i in range(N, -1, -1):
    a = cumA[i]
    if a > K:
        continue

    b = K - a

    low = 0
    high = M

    while low <= high:
        mid = (low + high) //2
        guess = cumB[mid]
        if guess <= b:
            if mid == M:
                break
            elif cumB[mid+1] > b:
                break

        if guess > b:
            high = mid -1
        else:
            low = mid + 1

    """
    for j in range(M, -1, -1):
        if i + j == ans:
            break
        if a + cumB[j] <= K:
            break
    """
    ans = max(i + mid, ans)   

print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

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

d = defaultdict(list)

p = 1
root = [p]

s, e = 0, 0

for i in range(K):
    d[p].append(i)
    if len(d[p]) == 2:
        s = d[p][0]
        e = i
        break
    root.append(A[p - 1])
    p = A[p - 1]
#print(s, e)

#print(root)

n = (K - s) % (e - s)
print(root[s + n])

Fixed submission:
from collections import defaultdict

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

d = defaultdict(list)

p = 1
root = []

#s, e = 0, 0

for i in range(K):
    d[p].append(i)
    root.append(p)
    if len(d[p]) == 2:
        s = d[p][0]
        e = i
        n = (K - s) % (e - s)
        p = root[s + n]
        break
    p = A[p - 1]
#print(s, e)

#print(root)

#n = (K - s) % (e - s)
print(p)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

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

d = defaultdict(list)
root = []
p = 1

s, e = 0, 0

for i in range(K):
    d[p].append(i)
    root.append(A[p - 1])
    if len(d[p]) == 2:
        s = d[p][0]
        e = i
        break
    p = A[p - 1]
#print(s, e)

#print(root)

n = (K - s) % (e - s)
#print(n)
print(root[s + n - 1])

Fixed submission:
from collections import defaultdict

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

d = defaultdict(list)

p = 1
root = []

#s, e = 0, 0

for i in range(K):
    d[p].append(i)
    root.append(p)
    if len(d[p]) == 2:
        s = d[p][0]
        e = i
        n = (K - s) % (e - s)
        p = root[s + n]
        break
    p = A[p - 1]
#print(s, e)

#print(root)

#n = (K - s) % (e - s)
print(p)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

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

d = defaultdict(list)
root = []
p = 1

s, e = 0, 0

for i in range(10):
    d[p].append(i)
    root.append(A[p - 1])
    if len(d[p]) == 2:
        s = d[p][0]
        e = i
        break
    p = A[p - 1]
#print(s, e)

#print(root)

n = (K - s) % (e - s)
#print(n)
print(root[s + n - 1])

Fixed submission:
from collections import defaultdict

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

d = defaultdict(list)

p = 1
root = []

#s, e = 0, 0

for i in range(K):
    d[p].append(i)
    root.append(p)
    if len(d[p]) == 2:
        s = d[p][0]
        e = i
        n = (K - s) % (e - s)
        p = root[s + n]
        break
    p = A[p - 1]
#print(s, e)

#print(root)

#n = (K - s) % (e - s)
print(p)
Buggy python submission (verdict: Runtime Error):
X = int(input())

A = 1
while True:
    b = (A ** 5 - X)
    c = abs(b) / b
    B = abs(b) ** (0.2)
    if int(B) == B:
        break
    A += 1
print(A, int(c * B))

Fixed submission:
X = int(input())

A = []
for i in range(1000):
    A.append(i ** 5)

x, y = 0, 0

flag = False
for i, a in enumerate(A):
    for j, b in enumerate(A[i+1:]):
        if b - a == X:
            flag = True
            x = j + i + 1
            y = i
            break
        if a + b == X:
            flag = True
            x = i
            y = -(j + i + 1)
            break
    if flag:
        break
print(x, y)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
A = A.reshape(-1, 1)
B = A + A.T - np.arange(1, N+1) + np.arange(1, N+1).reshape(-1, 1)
print(np.sum(B == 0))


Fixed submission:
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
ai = defaultdict(int)
aj = defaultdict(int)

for i, a in enumerate(A):
    ai[i + 1 + a] += 1
    aj[i + 1 - a] += 1

ans = 0
for k, v in ai.items():
    ans += v * aj[k]
print(ans)

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

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

ans = 0

for i, a in enumerate(A):
    ans += np.sum(A[i+a+1:] == np.arange(1, N-i-a))
    """
    for j, b in enumerate(A[i+a+1:]):
        if j + 1 == b:
            ans += 1
    """
print(ans)

Fixed submission:
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
ai = defaultdict(int)
aj = defaultdict(int)

for i, a in enumerate(A):
    ai[i + 1 + a] += 1
    aj[i + 1 - a] += 1

ans = 0
for k, v in ai.items():
    ans += v * aj[k]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

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

ans = 0
for a, b in itertools.combinations(range(N), 2):
    if (b - a) == (A[a] + A[b]):
        ans += 1
print(ans)

Fixed submission:
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
ai = defaultdict(int)
aj = defaultdict(int)

for i, a in enumerate(A):
    ai[i + 1 + a] += 1
    aj[i + 1 - a] += 1

ans = 0
for k, v in ai.items():
    ans += v * aj[k]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = []

for _ in range(N):
    s = input()
    if s not in ans:
        ans.append(s)
print(len(ans))

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

for _ in range(N):
    s = input()
    ans.add(s)
print(len(ans))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K = map(int, input().split())
n = N
while 1:
	a = np.minumum(n, np.abs(n - K))
	if a == n:
		break
print(a)

Fixed submission:
import numpy as np
N, K = map(int, input().split())
a = N % K
b = K - a
print(min([a, b]))
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = map(int, input().split())

num_blue = 0
num_all = 0
while 1:
    num_blue += A
    num_all += A
    if N <= num_all:
        num_blue -= num_all - N
    num_all += B
    if N <= num_all:
        break
    

print(num_blue)

Fixed submission:
N, A, B = map(int, input().split())
num_put = A + B
num_blue = N // num_put * A + min(A, N % num_put)
print(num_blue)

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

b = ''
while len(b) < N:
    b += 'b' * A
    b += 'r' * B

print(b[:N].count('b'))

Fixed submission:
N, A, B = map(int, input().split())
num_put = A + B
num_blue = N // num_put * A + min(A, N % num_put)
print(num_blue)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())

x = N / 1.08
c = int(np.ceil(x))
f = int(np.floor(x))
if int(c * 1.08) == N:
  print(c)
elif int(f * 1.08) == N:
  print(f)
else:
  print(':('

Fixed submission:
import numpy as np
N = int(input())

x = N / 1.08
c = int(np.ceil(x))
f = int(np.floor(x))
if int(c * 1.08) == N:
  print(c)
elif int(f * 1.08) == N:
  print(f)
else:
  print(':(')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ans = 0

for i in range(1000):
    t = '%03d' % i
    j = 0
    for s in S:
        if s == t[j]:
            j += 1
        if j== 3:
            ans += 1
            break

print(ans)

Fixed submission:
from collections import defaultdict

N = int(input())
S = input()

d = defaultdict(list)
for i, s in enumerate(S):
    d[s].append(i)
ans = 0

for i in range(1000):
    T = '%03d' % i
    j = -1
    for t in T:
        flag = True
        for k in d[t]:
            if k > j:
                flag = False
                j = k
                break
        if flag:
            break
    if not(flag):
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
zero = []
turn = []

def sum_n(n):
    return (n ** 2 + n) // 2

for i, s in enumerate(S):
    if i == 0:
        if s == '<':
            zero.append(i)
        else:
            turn.append(-1)
    else:
        if s_ == '>' and s == '<':
            zero.append(i)
        elif s_ == '<' and s == '>':
            turn.append(i)
    if i == len(S) - 1:
        if s == '>':
            zero.append(i + 1)
        else:
            turn.append(i + 1)
            zero.append(i + 2)
    s_ = s

#print(len(zero), zero)
#print(len(turn), turn)

ans = 0

for i in range(len(turn)):
    ans += sum_n(zero[i+1] - turn[i] - 1)
    ans += sum_n(turn[i] - zero[i] - 1)
    ans += max(zero[i+1] - turn[i], turn[i] - zero[i])
print(ans)

Fixed submission:
S = input()
zero = []
turn = []

def sum_n(n):
    return (n ** 2 + n) // 2

for i, s in enumerate(S):
    if i == 0:
        if s == '<':
            zero.append(i)
        else:
            turn.append(i)
            zero.append(-1)
    else:
        if s_ == '>' and s == '<':
            zero.append(i)
        elif s_ == '<' and s == '>':
            turn.append(i)
    if i == len(S) - 1:
        if s == '>':
            zero.append(i + 1)
        else:
            turn.append(i + 1)
            zero.append(i + 2)
    s_ = s

#print(len(zero), zero)
#print(len(turn), turn)

ans = 0

for i in range(len(turn)):
    ans += sum_n(zero[i+1] - turn[i] - 1)
    ans += sum_n(turn[i] - zero[i] - 1)
    ans += max(zero[i+1] - turn[i], turn[i] - zero[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

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

ans = 0

for a, b, c in combinations(L, 3):
    if a >= b + c:
        continue
    elif b >= a + c:
        continue
    elif c >= a + b:
        continue
    else:
        ans += 1
    
print(ans)

Fixed submission:
from itertools import combinations
from collections import defaultdict

N = int(input())
L = list(map(int, input().split()))
L_ = sorted(L)
d = defaultdict(int)

for l in L_:
    d[l] += 1

n = 0
for i in range(2001):
    n += d[i]
    d[i] += n - d[i]

ans = 0

for a, b in combinations(L_, 2):
    #print(a, b, d[a+b-1], d[abs(a-b)], d[a+b-1] - d[abs(a-b)])
    n =  d[a+b-1] - d[abs(a-b)]
    if abs(a-b) < a:
        ans -= 1
    if abs(a-b) < b:
        ans -= 1
    ans += n
    
print(ans//3)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K, Q = map(int, input().split())
A = np.array([int(input()) for _ in range(Q)])

base = K - Q

u, counts = np.unique(A, return_counts=True)

for i in range(N): 
    if base > 0:
        print('Yes')
    else:
        n = i + 1
        if n in u:
            if base + counts[u == n] > 0:
                print('Yes')
            else:
                print('No')
        else:
            print('No')

Fixed submission:
from collections import defaultdict

N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]

base = K - Q

d = defaultdict(int)
for a in A:
    d[a] += 1

for i in range(N): 
    if base > 0:
        print('Yes')
    else:
        n = i + 1
        if base + d[n] > 0:
            print('Yes')
        else:
            print('No')
Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())

E = (C * D) // math.gcd(C, D)

c = B // C - (A - 1) // C 
d = B // D - (A - 1) // D 
e = B // E - (A - 1) // E
ans = B - A - c - d + e + 1
print(ans)

Fixed submission:
import fractions
A, B, C, D = map(int, input().split())

E = (C * D) // fractions.gcd(C, D)

c = B // C - (A - 1) // C 
d = B // D - (A - 1) // D 
e = B // E - (A - 1) // E
ans = B - A - c - d + e + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]

card = np.array([i+1 for i in range(N)])

for l, r in LR:
    card = card[(card >= l) & (card <= r)]
    if len(card) == 0:
        break
print(len(card))

Fixed submission:
N, M = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]

card_min = 0
card_max = N
ans = N
#print(card_min, card_max)
for l, r in LR:
    if l > card_min:
        card_min = l
    if r < card_max:
        card_max = r
    #print(card_min, card_max)
    ans = card_max - card_min + 1
    if ans <= 0:
        ans = 0
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

N, K = map(int, input().split())

p1 = max(N - K + 1, 0) / N
p2 = 0.
l2K = math.log2(K)
for k in range(1, min(K, N+1)):
    p2 += (1 / N) * (0.5) ** int(l2K - math.log2(k) + 1)

print(p1 + p2)

Fixed submission:
import numpy as np

N, K = map(int, input().split())

p1 = max(N - K + 1, 0) / N
p2 = 0.
l2K = np.log2(K)
for k in range(1, min(K, N+1)):
    p2 += (0.5) ** np.ceil(l2K - np.log2(k))

print(p1 + p2 / N)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(S[l-1:r].count('AC'))

for a in ans:
    print(a)

Fixed submission:
N, Q = map(int, input().split())
S = input()

counts = [0]
c = 0
for i, s in enumerate(S[1:]):
    if (S[i] == 'A') and (s == 'C'):
        c += 1
    counts.append(c)

ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(counts[r-1] - counts[l-1])
    #ans.append(S[l-1:r].count('AC'))

for a in ans:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from itertools import combinations

N = int(input())
S = input()
Q = int(1e9 + 7)

d = defaultdict(int)
keys = set()

for s in S:
    d[s] += 1
    keys.add(s)

ans = 0

for i in range(0, len(keys)):
    for c in combinations(keys, i+1):
        n = 1
        for k in c:
            n *= d[k]
        ans += n
        ans %= Q

print(ans)

Fixed submission:
from collections import defaultdict

N = int(input())
S = input()
Q = int(1e9 + 7)

d = defaultdict(int)

for s in S:
    d[s] += 1

ans = 1
for k, v in d.items():
    ans *= (v + 1)
    ans %= Q
ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M, C = map(int, input().split()) 
B = np.array(list(map(int, input().split())))
A = np.array([list(map(int,list(input()))) for i in range(N)])

ans = 0
for i in range(N):
    val = np.sum(A[i, :] * B) + C
    if val > 0:
        ans += 1
print(ans)


Fixed submission:
import numpy as np
N, M, C = map(int, input().split()) 
B = np.array(list(map(int, input().split())))
A = np.array([list(map(int,list(input().split()))) for i in range(N)])
 
ans = 0
for i in range(N):
    val = np.sum(A[i, :] * B) + C
    if val > 0:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M, C = map(int, input().split()) 
B = np.array(list(map(int, input().split())))
A = np.array([list(map(int,list(input()))) for i in range(N)])

ans = 0
for i in range(M):
  if np.sum(A[:, i] * B) + C > 0:
    ans += 1
print(ans)

Fixed submission:
import numpy as np
N, M, C = map(int, input().split()) 
B = np.array(list(map(int, input().split())))
A = np.array([list(map(int,list(input().split()))) for i in range(N)])
 
ans = 0
for i in range(N):
    val = np.sum(A[i, :] * B) + C
    if val > 0:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
h = list(map(int, input().split()))

ans = min(h)
h_ = [n - ans for n in h] + [0]
j = -1
while max(h_) > 0:
    for i, n in enumerate(h_):
        if n == 0:
            if (j + 1) < i:
                m = min(h_[j+1:i])
                ans += m
                for k in range(j+1, i):
                    h_[k] = h_[k] - m
            j = i
    #print(h_)

print(ans)

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

ans = min(h)
h_ = [n - ans for n in h] + [0]
while max(h_) > 0:
    j = -1
    for i, n in enumerate(h_):
        if n == 0:
            if (j + 1) < i:
                m = min(h_[j+1:i])
                ans += m
                for k in range(j+1, i):
                    h_[k] = h_[k] - m
            j = i

print(ans)

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


ans = min(h)
h_ = [n - ans for n in h]
j = -1
while max(h_) > 0:
    for i, n in enumerate(h_):
        if n == 0:
            if (j + 1) < i:
                m = min(h_[j+1:i])
                ans += m
                for k in range(j+1, i):
                    h_[k] = h_[k] - m
            j = i
    if (j + 1) < N:
        m = min(h_[j+1:])
        ans += m
        for k in range(j+1, N):
            h_[k] = h_[k] - m

print(ans)

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

ans = min(h)
h_ = [n - ans for n in h] + [0]
while max(h_) > 0:
    j = -1
    for i, n in enumerate(h_):
        if n == 0:
            if (j + 1) < i:
                m = min(h_[j+1:i])
                ans += m
                for k in range(j+1, i):
                    h_[k] = h_[k] - m
            j = i

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

for i in range(A, B+1):
    if i < A + K or i > B - K:
        print(i)

Fixed submission:
A, B, K = map(int, input().split())

if B - A > 2 * K:
    for i in range(A, A + K):
        print(i)
    for i in range(B - K+1, B+1):
        print(i) 
else:
    for i in range(A, B+1):
        if i < A + K or i > B - K:
            print(i)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=m*1900+(n-m)*100
print(sec*2**m)

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

sec = M * 1900 + (N - M) * 100
print(sec * 2 ** M)
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect

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

A.sort()
B.sort()
C.sort()

ans = 0

for a in A:
    i = bisect(B, a)
    for b in B[i:]:
        j = bisect(C, b)
        ans += N - j

print(ans)

Fixed submission:
from bisect import bisect
import random


def binary_search(L, n, i, j):
    # print(L, n, i, j)
    low = i
    high = j

    while low <= high:
        mid = (low + high) //2
        guess = L[mid]
        # if guess == n:
            # return mid
        if guess > n:
            high = mid -1
        else:
            low = mid + 1
    # print(low)
    return low

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
# N = 10 ** 5
# A = [random.randint(1, 10**9) for _ in range(N)]
# B = [random.randint(1, 10**9) for _ in range(N)]
# C = [random.randint(1, 10**9) for _ in range(N)]

A.sort()
B.sort()
C.sort()

ans = 0
i, j = 0, 0

A_ind = []
B_cum = [0]

for a in A:
    # i = binary_search(B, a, i, N-1)
    i = bisect(B, a)
    A_ind.append(i)

s = 0
for b in B:
    # j = binary_search(C, b, j, N-1)
    j = i = bisect(C, b)
    s += N-j
    B_cum.append(s)

for a in A_ind:
    ans += B_cum[-1] - B_cum[a]
print(ans)
Buggy python submission (verdict: Runtime Error):
# ABC075 B-Minesweeper
import numpy as np

H, W = map(int, input().split())
s = np.zeros((H+2, W+2))

for i in range(H):
    S = input()
    for j, v in enumerate(S):
        if v == '#':
            s[i+1, j+1] = 1

for i in range(H):
    ans = ''
    for j in range(W):
        if s[i+1, j+1] == 1:
            ans += '#'
        else:
            ans += str(np.sum(s[i:i+3, j:j+3], dtype=np.int))
    print(ans)


Fixed submission:
# ABC075 B-Minesweeper
import numpy as np

H, W = map(int, input().split())
s = np.zeros((H+2, W+2))

for i in range(H):
    S = input()
    for j, v in enumerate(S):
        if v == '#':
            s[i+1, j+1] = 1

for i in range(H):
    ans = ''
    for j in range(W):
        if s[i+1, j+1] == 1:
            ans += '#'
        else:
            ans += str(np.sum(s[i:i+3, j:j+3], dtype=np.int))
    print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = list(map(int, input().split()))
V = np.zeros((max(a)+4, N))

for i, v in enumerate(a):
    V[v:v+3, i] = 1
#print(V)
print(np.max(np.sum(V, axis=1, dtype=np.int)))

Fixed submission:
import numpy as np
N = int(input())
a = list(map(int, input().split()))
V = np.zeros((max(a)+4))

for v in a:
    V[v:v+3] += 1 
print(int(np.max(V)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = list(map(int, input().split()))
V = np.zeros((max(a)+3, N))

for i, v in enumerate(a):
    V[v:v+3, i] = 1
print(np.max(np.sum(V, axis=1, dtype=np.int)))

Fixed submission:
import numpy as np
N = int(input())
a = list(map(int, input().split()))
V = np.zeros((max(a)+4))

for v in a:
    V[v:v+3] += 1 
print(int(np.max(V)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = list(map(int, input().split()))
V = np.zeros((max(a)+3, N))

for i, v in enumerate(a):
    V[v:v+3, i] = 1
print(np.max(np.sum(V, axis=1, dtype=np.int)))

Fixed submission:
import numpy as np
N = int(input())
a = list(map(int, input().split()))
V = np.zeros((max(a)+4))

for v in a:
    V[v:v+3] += 1 
print(int(np.max(V)))