Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k)
    Cn.append(k-An[k])
Bn_Cn = set(Bn) & set(Cn)
for i in Bn_Cn:
    c+= Bn.count(i) * Cn.count(i)
print(c)

Fixed submission:
from collections import Counter
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k)
    Cn.append(k-An[k])
Cj = Counter(Cn)
for i in Bn:
    c+=Cj[i]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k+1)
    Cn.append(k+1-An[k])
Bn_and_Cn = set(Bn) & set(Cn)
for i in Bn_and_Cn:
    c += Bn.count(i) * Cn.count(i)
print(c)

Fixed submission:
from collections import Counter
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k)
    Cn.append(k-An[k])
Cj = Counter(Cn)
for i in Bn:
    c+=Cj[i]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
Bn = Bn + An
Cn = Cn + An
for k in range(N):    
    Bn[k] = Bn[k] + k + 1
    Cn[k] = k + 1 - Cn[k]
Bn_and_Cn = set(Bn) & set(Cn)
for i in Bn_and_Cn:
    c += Bn.count(i) * Cn.count(i)
print(c)

Fixed submission:
from collections import Counter
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k)
    Cn.append(k-An[k])
Cj = Counter(Cn)
for i in Bn:
    c+=Cj[i]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
Bn = Bn + An
Cn = Cn + An
for k in range(N):    
    Bn[k] = Bn[k] + k + 1
    Cn[k] = k + 1 - Cn[k]
for X in range(1,N):
    if X in Bn and X in Cn:
        c = c + Bn.count(X) * Cn.count(X)
print(c)

Fixed submission:
from collections import Counter
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k)
    Cn.append(k-An[k])
Cj = Counter(Cn)
for i in Bn:
    c+=Cj[i]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
An = input().split()
c = 0
for i in range(N):
    An[i] = int(An[i])
Bn = []
Cn = []
Bn = Bn + An
Cn = Cn + An
for k in range(N):    
    Bn[k] = Bn[k] + k + 1
    Cn[k] = k + 1 - Cn[k]
for X in range(1,N):
    if X in Bn and X in Cn:
        c = c + Bn.count(X) * Cn.count(X)
print(c)

Fixed submission:
from collections import Counter
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k)
    Cn.append(k-An[k])
Cj = Counter(Cn)
for i in Bn:
    c+=Cj[i]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
An = input().split()
c = 0
for i in range(N):
    An[i] = int(An[i])
for X in range(1,N):    
    for i in range(N):
        if An[i] + i == X:
            for k in range(N):
                if k - An[k] == X:
                    c = c + 1
print(c)

Fixed submission:
from collections import Counter
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k)
    Cn.append(k-An[k])
Cj = Counter(Cn)
for i in Bn:
    c+=Cj[i]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
An = input().split()
c = 0
for i in range(N):
    An[i] = int(An[i])
for i in range(N):
    for k in range(1,N-i):
        if An[0] + An[k] == k :
            c = c + 1
    del An[0]
print(c)


Fixed submission:
from collections import Counter
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k)
    Cn.append(k-An[k])
Cj = Counter(Cn)
for i in Bn:
    c+=Cj[i]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
An = input().split()
c = 0
for i in range(N):
    An[i] = int(An[i])
for i in range(N):
    for k in range(i+1,N):
        if An[i] + An[k] == k - i :
            c = c + 1
print(c)
        

Fixed submission:
from collections import Counter
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k)
    Cn.append(k-An[k])
Cj = Counter(Cn)
for i in Bn:
    c+=Cj[i]
print(c)