Language: C++

#include #include <bits/stdc++.h>

#define ll long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)

using namespace std;

int main()
{
  int N; cin>>N;
  vector<ll> a(N);
  rep(i,N) cin>>a[i];
  vector<ll> b(N),c(N);
  rep(i,N) b[i] = a[i]+i;
  rep(i,N) c[i] = i-a[i];
  map<ll,int> Map;
  ll ans=0;
  RFOR(i,N-1,1){
    Map[c[i]]++;
    ans+=Map[b[i-1]];
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc:1:10: error: #include expects "FILENAME" or <FILENAME>
    1 | #include #include <bits/stdc++.h>
      |          ^
a.cc: In function 'int main()':
a.cc:12:10: error: 'cin' was not declared in this scope
   12 |   int N; cin>>N;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #include #include <bits/stdc++.h>
a.cc:13:3: error: 'vector' was not declared in this scope
   13 |   vector<ll> a(N);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #include #include <bits/stdc++.h>
a.cc:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
a.cc:13:10: note: in expansion of macro 'll'
   13 |   vector<ll> a(N);
      |          ^~
a.cc:14:17: error: 'a' was not declared in this scope
   14 |   rep(i,N) cin>>a[i];
      |                 ^
a.cc:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
a.cc:15:10: note: in expansion of macro 'll'
   15 |   vector<ll> b(N),c(N);
      |          ^~
a.cc:16:12: error: 'b' was not declared in this scope
   16 |   rep(i,N) b[i] = a[i]+i;
      |            ^
a.cc:16:19: error: 'a' was not declared in this scope
   16 |   rep(i,N) b[i] = a[i]+i;
      |                   ^
a.cc:17:12: error: 'c' was not declared in this scope
   17 |   rep(i,N) c[i] = i-a[i];
      |            ^
a.cc:17:21: error: 'a' was not declared in this scope
   17 |   rep(i,N) c[i] = i-a[i];
      |                     ^
a.cc:18:3: error: 'map' was not declared in this scope
   18 |   map<ll,int> Map;
      |   ^~~
a.cc:1:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
  +++ |+#include <map>
    1 | #include #include <bits/stdc++.h>
a.cc:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
a.cc:18:7: note: in expansion of macro 'll'
   18 |   map<ll,int> Map;
      |       ^~
a.cc:21:5: error: 'Map' was not declared in this scope
   21 |     Map[c[i]]++;
      |     ^~~
a.cc:21:9: error: 'c' was not declared in this scope
   21 |     Map[c[i]]++;
      |         ^
a.cc:22:14: error: 'b' was not declared in this scope
   22 |     ans+=Map[b[i-1]];
      |              ^
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout<<ans<<endl;
      |   ^~~~
a.cc:24:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:14: error: 'endl' was not declared in this scope
   24 |   cout<<ans<<endl;
      |              ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #include #include <bits/stdc++.h>