Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
#define int long long;
signed main(){
	int n;cin>>n;
	
	int a[200000];
	int b[200000];
	for(int i=0;i<n;i++){
		scanf("%d", &a[i]);
		b[i]=i-a[i];
		a[i]=i+a[i];
	}
	sort(a,a+n);
	sort(b,b+n);
	int ans=0;
	int j=0;
	for(int i=0;i<n and j<n;i++){
		int acount=0;
		int bcount=0;
		while(a[i]>b[j] and j<n){j++;if(j==n){break;}}
		if(j==n){break;}
		if(b[j]>a[i]){continue;}
		else{
		
			int s=a[i];
			while(a[i]==s){
				acount++;
				i++;
				if(i==n){break;}
			}
			i--;
			while(b[j]==s){
				bcount++;
				j++;
				if(j==n){break;}
			}
			ans+=acount*bcount;
			//cout<<s<<" "<<acount*bcount<<endl;
		}
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:6:9: note: in expansion of macro 'int'
    6 |         int n;cin>>n;
      |         ^~~
a.cc:6:13: error: 'n' was not declared in this scope
    6 |         int n;cin>>n;
      |             ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:8:9: note: in expansion of macro 'int'
    8 |         int a[200000];
      |         ^~~
a.cc:8:13: error: 'a' was not declared in this scope
    8 |         int a[200000];
      |             ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:9:9: note: in expansion of macro 'int'
    9 |         int b[200000];
      |         ^~~
a.cc:9:13: error: 'b' was not declared in this scope
    9 |         int b[200000];
      |             ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:10:13: note: in expansion of macro 'int'
   10 |         for(int i=0;i<n;i++){
      |             ^~~
a.cc:10:17: error: 'i' was not declared in this scope
   10 |         for(int i=0;i<n;i++){
      |                 ^
a.cc:10:24: error: expected ')' before ';' token
   10 |         for(int i=0;i<n;i++){
      |            ~           ^
      |                        )
a.cc:10:25: error: 'i' was not declared in this scope
   10 |         for(int i=0;i<n;i++){
      |                         ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:17:9: note: in expansion of macro 'int'
   17 |         int ans=0;
      |         ^~~
a.cc:17:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |         int ans=0;
      |             ^~~
      |             abs
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:18:9: note: in expansion of macro 'int'
   18 |         int j=0;
      |         ^~~
a.cc:18:13: error: 'j' was not declared in this scope
   18 |         int j=0;
      |             ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:19:13: note: in expansion of macro 'int'
   19 |         for(int i=0;i<n and j<n;i++){
      |             ^~~
a.cc:19:32: error: expected ')' before ';' token
   19 |         for(int i=0;i<n and j<n;i++){
      |            ~                   ^
      |                                )