Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 21:56:12 2020

@author: riichi
"""
import numpy as np

N = int(input())
A = list(map(int,input().split()))
a = np.array([],dtype = int)
b = np.array([],dtype = int)

A = np.array(A)
ans = 0
for i in range(N-1):
    a = np.append(a,1-A[i])
    a = a + 1
    
a = a-1

for i in range(N):
    b = np.append(b,A[i])
    b = b + 1

b = b - 1
a = np.sort(a)
b = np.sort(b)

for i in b:
    ans += np.count_nonzero(a==i)


print(ans)
    
    
    

Fixed submission:
import collections

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

L = [A[x]+x+1 for x in range(N)]
R = [x+1-A[x] for x in range(N)]

cL = collections.Counter(L)
cR = collections.Counter(R)

cRlist = list(cR.keys())

for i in range(len(cRlist)):
    tmp = cRlist[i]
    ans += cR.get(tmp,0) * cL.get(tmp,0)
    
print(ans)

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

N = int(input())
A = list(map(int,input().split()))
a = np.array([],dtype = int)
b = np.array([],dtype = int)

A = np.array(A)
ans = 0
for i in range(N-1):
    a = np.append(a,1-A[i])
    a = a + 1
    
a = a-1

for i in range(N):
    b = np.append(b,A[i])
    b = b + 1

b = b - 1


for i in b:
    ans += np.count_nonzero(a==i)


print(ans)
    

Fixed submission:
import collections

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

L = [A[x]+x+1 for x in range(N)]
R = [x+1-A[x] for x in range(N)]

cL = collections.Counter(L)
cR = collections.Counter(R)

cRlist = list(cR.keys())

for i in range(len(cRlist)):
    tmp = cRlist[i]
    ans += cR.get(tmp,0) * cL.get(tmp,0)
    
print(ans)

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

N = int(input())
A = list(map(int,input().split()))
a = np.array([],dtype = int)

ans = 0
for i in range(N-1):
    a = np.append(a,1-A[i])
    ans += np.count_nonzero(a==A[i+1])
    a = a + 1

print(ans)

Fixed submission:
import collections

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

L = [A[x]+x+1 for x in range(N)]
R = [x+1-A[x] for x in range(N)]

cL = collections.Counter(L)
cR = collections.Counter(R)

cRlist = list(cR.keys())

for i in range(len(cRlist)):
    tmp = cRlist[i]
    ans += cR.get(tmp,0) * cL.get(tmp,0)
    
print(ans)

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

N = int(input())
A = list(map(int,input().split()))
a = np.array([],dtype = int)

ans = 0
for i in range(N-1):
    a = np.append(a,1-A[i])
    a = np.sort(a)
    ans += np.count_nonzero(a==A[i+1])
    a = a + 1

print(ans)

Fixed submission:
import collections

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

L = [A[x]+x+1 for x in range(N)]
R = [x+1-A[x] for x in range(N)]

cL = collections.Counter(L)
cR = collections.Counter(R)

cRlist = list(cR.keys())

for i in range(len(cRlist)):
    tmp = cRlist[i]
    ans += cR.get(tmp,0) * cL.get(tmp,0)
    
print(ans)

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

import itertools

seq = (x for x in range(N))
ptr = list(itertools.combinations(seq,2))
ans = 0
for i in range(len(ptr)):
    if A[ptr[i][0]]+A[ptr[i][1]]==ptr[i][1]-ptr[i][0]:
        ans += 1
        
print(ans)

Fixed submission:
import collections

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

L = [A[x]+x+1 for x in range(N)]
R = [x+1-A[x] for x in range(N)]

cL = collections.Counter(L)
cR = collections.Counter(R)

cRlist = list(cR.keys())

for i in range(len(cRlist)):
    tmp = cRlist[i]
    ans += cR.get(tmp,0) * cL.get(tmp,0)
    
print(ans)