Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
Hs = np.array(list(map(int, input().split())))
As = np.tile(Hs, (N, 1))
h = As.T.copy()
L = np.array([i for i in range(N)])
idxs = np.tile(L, (N, 1))
tidxs = idxs.T.copy()
try:
    co = As + h - np.abs(idxs-tidxs)
except:
    co = As
ans = N**2-np.count_nonzero(co)
print(ans//2)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
L = [A[i]+i for i in range(N)]
R = [i-A[i] for i in range(N)]
c = Counter(R)

ans = 0
for l in L:
    ans += c[l]

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
Hs = np.array(list(map(int, input().split())), dtype='int64')
As = np.tile(Hs, (N, 1))
h = As.T.copy()
L = np.array([i for i in range(N)], dtype='int64')
idxs = np.tile(L, (N, 1))
tidxs = idxs.T.copy()
co = As + h - np.abs(idxs-tidxs)
ans = N**2-np.count_nonzero(co)
print(ans//2)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
L = [A[i]+i for i in range(N)]
R = [i-A[i] for i in range(N)]
c = Counter(R)

ans = 0
for l in L:
    ans += c[l]

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
Hs = np.array(list(map(int, input().split())), dtype='int64').reshape(-1, 1)
As = Hs.repeat(N, axis=1)
h = As.T.copy()
L = np.array([i for i in range(N)], dtype='int64').reshape(-1, 1)
idxs = L.repeat(N, axis=1)
tidxs = idxs.T.copy()
co = As + h - np.abs(idxs-tidxs)
ans = N**2-np.count_nonzero(co)
print(ans//2)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
L = [A[i]+i for i in range(N)]
R = [i-A[i] for i in range(N)]
c = Counter(R)

ans = 0
for l in L:
    ans += c[l]

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
Hs = np.array(list(map(int, input().split()))).reshape(-1, 1)
As = Hs.repeat(N, axis=1)
h = As.T.copy()
L = np.array([i for i in range(N)]).reshape(-1, 1)
idxs = L.repeat(N, axis=1)
tidxs = idxs.T.copy()
co = As + h - np.abs(idxs-tidxs)
ans = N**2-np.count_nonzero(co)
print(ans//2)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
L = [A[i]+i for i in range(N)]
R = [i-A[i] for i in range(N)]
c = Counter(R)

ans = 0
for l in L:
    ans += c[l]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
Hs = list(map(int, input().split()))
As = np.array([Hs for _ in range(N)])
h = As.T.copy()
idxs = np.tile([i for i in range(N)], (N, 1))
tidxs = idxs.T.copy()
co = As + h - np.abs(idxs-tidxs)
ans = N**2-np.count_nonzero(co)
print(ans//2)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
L = [A[i]+i for i in range(N)]
R = [i-A[i] for i in range(N)]
c = Counter(R)

ans = 0
for l in L:
    ans += c[l]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
Hs = list(map(int, input().split()))
As = np.array([Hs for _ in range(N)])
h = np.array([[Hs[i]]*N for i in range(N)])
co = As + h - np.array([[abs(n-i) for i in range(N)] for n in range(N)])
ans = N**2-np.count_nonzero(co)
print(ans//2)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
L = [A[i]+i for i in range(N)]
R = [i-A[i] for i in range(N)]
c = Counter(R)

ans = 0
for l in L:
    ans += c[l]

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
Hs = list(map(int, input().split()))
nHs = np.array(Hs)
h = np.tile(nHs, (N, 1))
co = h - np.array([[abs(n-i)-Hs[n] for i in range(N)] for n in range(N)])
ans = np.sum(co==0)
print(ans//2)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
L = [A[i]+i for i in range(N)]
R = [i-A[i] for i in range(N)]
c = Counter(R)

ans = 0
for l in L:
    ans += c[l]

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
Hs = list(map(int, input().split()))
nHs = np.array(Hs)
h = np.tile(nHs, (N, 1))
co = h - np.array([[abs(n-i)-Hs[n] for i in range(N)] for n in range(N)])
ans = N**2-np.count_nonzero(co)
print(ans//2)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
L = [A[i]+i for i in range(N)]
R = [i-A[i] for i in range(N)]
c = Counter(R)

ans = 0
for l in L:
    ans += c[l]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
Hs = list(map(int, input().split()))
As = np.array([Hs for _ in range(N)])
h = np.array([[Hs[i]]*N for i in range(N)])
co = As + h - np.array([[abs(n-i) for i in range(N)] for n in range(N)])
ans = np.sum(co==0)
print(ans//2)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
L = [A[i]+i for i in range(N)]
R = [i-A[i] for i in range(N)]
c = Counter(R)

ans = 0
for l in L:
    ans += c[l]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
As = np.array(list(map(int, input().split())))\

max_A = max(As)

ans = 0
for n in range(N):
    h = As[n]
    co = As.copy()
    co = co + h - np.array([abs(n-i) for i in range(N)])
    ans += np.sum(co==0)
print(ans//2)
    
    
    
    

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
L = [A[i]+i for i in range(N)]
R = [i-A[i] for i in range(N)]
c = Counter(R)

ans = 0
for l in L:
    ans += c[l]

print(ans)