You are given an Array of length N. T-Rex wants you to count the number of pairs of (i, j) where 1⩽i<j⩽N such that the difference of the array elements on that indices is equal to the sum of the square of their indices.
That is, count the number of pairs of (i, j) such that it satisfies this equation (A[j] – A[i] = i2 + j2 ).
First line contains length of the array N. (1⩽N⩽105) The second line contains N integers representating Array elements (1⩽A[i]⩽1012)
Output the number of pairs that satisfy the above condition.
Pairs at indices : (1,2), (2,4), (1,5) satisfy the above condition.
in this program i used :-
this is only for reduce the time of execution we also write the code without this but when we use this this helps us to run the code faster .