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

N = int(input())
A = np.array(input().split(), np.int32)
S = np.array([A[i] - i for i in range(N)])
T = np.array([-A[i] - i for i in range(N)])
# j > i
# S[j] == T[i]
ans = 0
for j in range(N):
    for i in range(j - 1, -1, -1):
        if S[j] == T[i]:
            ans += 1
print(ans)


Fixed submission:
from _collections import defaultdict
import sys

read = sys.stdin.buffer.read
N = int(input())
A = [int(i) for i in input().split()]
D = defaultdict(int)

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

ans = 0
for i, a in enumerate(A, 1):
    ans += D[i + a]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
S = [A[i] - i for i in range(N)]
T = [-A[i] - i for i in range(N)]
# j > i
# S[j] == T[i]
ans = 0
for j in range(N):
    for i in range(j - 1, -1, -1):
        if S[j] == T[i]:
            ans += 1
print(ans)


Fixed submission:
from _collections import defaultdict
import sys

read = sys.stdin.buffer.read
N = int(input())
A = [int(i) for i in input().split()]
D = defaultdict(int)

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

ans = 0
for i, a in enumerate(A, 1):
    ans += D[i + a]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
S = [A[i] - i for i in range(N)]
T = [-A[i] - i for i in range(N)]
# j > i
# S[j] == T[i]
ans = 0
for j in range(N):
    for i in range(j - 1, -1, -1):
        if S[j] == T[i]:
            ans += 1
print(ans)


Fixed submission:
from _collections import defaultdict
import sys

read = sys.stdin.buffer.read
N = int(input())
A = [int(i) for i in input().split()]
D = defaultdict(int)

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

ans = 0
for i, a in enumerate(A, 1):
    ans += D[i + a]
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = np.array(input().split(), np.int32)
B = np.arange(1, N + 1)
X = A[None, :] + A[:, None]
Y = B[None, :] - B[:, None]
print(np.count_nonzero(X == Y))


Fixed submission:
from _collections import defaultdict
import sys

read = sys.stdin.buffer.read
N = int(input())
A = [int(i) for i in input().split()]
D = defaultdict(int)

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

ans = 0
for i, a in enumerate(A, 1):
    ans += D[i + a]
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = np.array(input().split(), np.float32)
B = np.arange(1, N + 1)
X = A[None, :] + A[:, None]
Y = np.abs(B[None, :] - B[:, None])
print(np.count_nonzero(X == Y) // 2)


Fixed submission:
from _collections import defaultdict
import sys

read = sys.stdin.buffer.read
N = int(input())
A = [int(i) for i in input().split()]
D = defaultdict(int)

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

ans = 0
for i, a in enumerate(A, 1):
    ans += D[i + a]
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array(input().split(), np.int64)
B = np.arange(1, N + 1)
X = A[None,:] + A[:,None]
Y = B[None,:] - B[:,None]
print(np.count_nonzero(X == Y))

Fixed submission:
from _collections import defaultdict
import sys

read = sys.stdin.buffer.read
N = int(input())
A = [int(i) for i in input().split()]
D = defaultdict(int)

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

ans = 0
for i, a in enumerate(A, 1):
    ans += D[i + a]
print(ans)