criyle/codenet-compile-errors huggingface dataset:
Language: C

#include <bits/stdc++.h>
using namespace std;
const int N = 1e9+7;
typedef long long LL;

int main()
{
	int i,j,n,y=0;
	cin>>n;
	LL x[n+1],l[n+1],r[n+1];
	for(i=1;i<=n;i++)
	{
		l[i]=0;r[i]=0;
	}
	for(i=1;i<=n;i++)
	{
		cin>>x[i];
	}
	for(i=1;i<=n;i++)
	{
		if( (x[i]+i)<=n ) l[x[i]+i]++;
		if( (i-x[i])>=1 ) r[i-x[i]]++;
	}
	for(i=1;i<=n;i++)
	{
		y=y+l[i]*r[i];
	}
	cout<<y<<endl;
	return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
int main()
{
int n,i;
  scanf("%d",&n);
long long int sw1[n],sw2[n],a[n],ans;
  
  for(i=0;i<n;++i)
  {
  sw1[i]=0;
  sw2[i]=0;
  scanf("%lld",&a[i]);
  }
  
  for(i=0;i<n;++i)
  {
  if(i-a[i]>=0) sw1[i-a[i]]++;
  if(i+a[i]<n) sw2[i+a[i]]++;
  }
  
  for(i=0;i<n;++i)
  {
  ans=ans+sw1*sw2;
  }
  
  printf("%lld",ans);

return 0;}

Compiler output:
main.c: In function 'main':
main.c:23:14: error: invalid operands to binary * (have 'long long int *' and 'long long int *')
   23 |   ans=ans+sw1*sw2;
      |          ~   ^
      |          |   |
      |          |   long long int *
      |          long long int *
Language: C

#include<stdio.h>
int main()
{
int n,i;
  scanf("%d",&n);
long long int sw1[n],sw2[n],a[n],ans;
  
  for(i=0;i<n;++i)
  {
  sw1[i]=0;
  sw2[i]=0;
  scanf("%lld",a[i]);
  }
  
  for(i=0;i<n;++i)
  {
  if(i-a[i]>=0) sw1[i-a[i]]++;
  if(i+a[i]<n) sw2[i+a[i]]++;
  }
  
  for(i=0;i<n;++i)
  {
  ans=ans+sw1*sw2;
  }
  
  printf("%lld",ans);

return 0;}

Compiler output:
main.c: In function 'main':
main.c:23:14: error: invalid operands to binary * (have 'long long int *' and 'long long int *')
   23 |   ans=ans+sw1*sw2;
      |          ~   ^
      |          |   |
      |          |   long long int *
      |          long long int *
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    long long N;
    std::cin >> N;

    std::vector<long long> A(N);
    for (long long i=0; i<N; i++) 
        std::cin >> A.at(i);

    long long ans = 0;
    // {}で0で初期化
    // https://tt4cs.hatenadiary.org/entry/20120219/1329636595
    long long cnt[200005] = {};
    for (int i=0; i<N; i++)
    {
        // j-A_j==i+A_i. j-A_j<=N, i+A_i>0
        if (i-A.at(i)>0) ans += cnt[i-A.at(i)];
        
        // i+A_i>Nは考えなくていい
        if (i+A.at(i))<=N) cnt[i+A.at(i)]++;
    }
    std::cout << ans;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:23: error: expected primary-expression before '<=' token
   24 |         if (i+A.at(i))<=N) cnt[i+A.at(i)]++;
      |                       ^~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    long long N;
    std::cin >> N;

    std::vector<long long> A(N);
    for (long long i=0; i<N; i++) 
        std::cin >> A.at(i);

    long long ans = 0;
    // {}で0で初期化
    // https://tt4cs.hatenadiary.org/entry/20120219/1329636595
    long long cnt[200005] = {};
    for (int i=0; i<N; i++)
    {
        if (i-A.at(i)>0)
        {
            ans += cnt[i-A.at(i)];
        }
        cnt[i+A.at(i)]++;
    }
    std::cout << ans;


Compiler output:
a.cc: In function 'int main()':
a.cc:26:22: error: expected '}' at end of input
   26 |     std::cout << ans;
      |                      ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

// https://atcoder.jp/contests/abc166/tasks/abc166_e

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,avx512f")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <vector>
namespace ABC166_E {

	using uint = unsigned int;
	signed main() {
		uint n;
		std::cin >> n;
		std::vector<uint> a;
		a.reserve(n);
		for (uint i = 0; i < n; ++i) { uint t; std::cin >> t; a.emplace_back(t); }

		std::vector<uint> ansv(16);

		const uint n16 = n / 16;
		uint now = 0;
		for (int k = 0; k < 16; ++k) {
			const uint nown16 = now + n16;
			for (uint i = now; i < nown16; ++i) {
				for (uint j = i + 1; j < n; ++j) {
					ansv[k] += (j - i) == a[j] + a[i];
				}
			}
			now += n16;
		}
		for (uint i = now; i < n; ++i) {
			for (uint j = i + 1; j < n; ++j) {
				ansv[15] += (j - i) == a[j] + a[i];
			}
		}

		uint ans = 0;
		for (const auto& x : ansv) { ans += x; }
		std::cout << ans << std::endl;

		return 0;
	}
}

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:6:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<unsigned int, std::allocator<unsigned int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = unsigned int]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C++

// https://atcoder.jp/contests/abc166/tasks/abc166_e

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,avx512f")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <vector>
namespace ABC166_E {

	using uint = unsigned int;
	signed main() {
		uint n;
		std::cin >> n;
		std::vector<uint> a;
		a.reserve(n);
		for (uint i = 0; i < n; ++i) { uint t; std::cin >> t; a.emplace_back(t); }

		std::vector<uint> ansv(8);

		for (uint i = 0; i < n; ++i) {
			const uint n8 = (n - i - 1) / 8;
			for (uint j = 0; j < n8; ++j) {
				uint j8 = i + 1 + 8 * j;
				for (uint k = 0; k < 8; ++k) {
					ansv[k] += (k + j8 - i) == a[k + j8] + a[i];
				}
			}
			uint s = i + 1 + n8 * 8;
			for (uint k = s; k < n; ++k) {
				ansv[k - s] += (k - i) == a[k] + a[i];
			}
		}
		long long ans = 0;
		for (const auto& x : ansv) { ans += x; }
		std::cout << ans << std::endl;

		return 0;
	}
}

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:6:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<unsigned int, std::allocator<unsigned int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = unsigned int]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C++

#include</Users/urarare/workspace_c++/include/bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A.at(i);
    map<int, set<int>> L, R;
    int LL, RR;
    for(int i=0; i<N; i++){
        LL = (i+1) + A.at(i);
        RR = (i+1) - A.at(i);
        if(L.count(LL)) L.at(LL).insert(i);
        else L[LL] = {i};
        if(R.count(RR)) R.at(RR).insert(i);
        else R[RR] = {i};
    }
    int count = 0;
    set<int> Rset;
    for(auto p : L){
        if(R.count(p.first)){
            Rset = R.at(p.first);
            auto itr = Rset.begin();
            int Rsize = Rset.size();
            for(auto l : p.second){
                int cnt = 0;
                while(l >= *itr){
                    itr++;
                    cnt++;
                    if(itr == Rset.end()) break;
                }
                count += (Rsize - cnt);
            }
        }
    } 
    cout << count << endl;
}

Compiler output:
a.cc:1:9: fatal error: /Users/urarare/workspace_c++/include/bits/stdc++.h: No such file or directory
    1 | #include</Users/urarare/workspace_c++/include/bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define deb(x) cout << #x << " " << x << "\n";
#define fo(i, n) for(i=0; i<n; i++)
#define Fo(i, k, n) for(i=k; i<n; i++)
#define endl "\n"
#define ll long long
#define vi vector<int>

// memset(arr, value, size);
long t, i, count;
map<long, long> l, r;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> t;

	fo(i, t) {
		long a;
		cin >> a;
		l[i + a]++;
		r[i - a]++;
	}

	for (auto el : l) {
		count += el.second * r[el.first];
	}

	cout << count;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: reference to 'count' is ambiguous
   28 |                 count += el.second * r[el.first];
      |                 ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:12:12: note:                 'long int count'
   12 | long t, i, count;
      |            ^~~~~
a.cc:31:17: error: reference to 'count' is ambiguous
   31 |         cout << count;
      |                 ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:12:12: note:                 'long int count'
   12 | long t, i, count;
      |            ^~~~~
Language: C++

#include <iostream>
#include <set>
#include <vector>
#include <iomanip>

#include <cfenv>
#include <cmath>
typedef long long int ll;

using namespace std;

int main()
{

    ll N;

    cin >> N;

    vector<ll> A(N);

    map<int, int> mp;


    ll sum=0;

    for (ll i = 1; i <= N; i++)
    {

        ll a;
        cin >> a;

        sum +=mp[i-a];

        mp[i+a]++;

    
    }

    

    cout << sum << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'map' was not declared in this scope
   21 |     map<int, int> mp;
      |     ^~~
a.cc:8:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    7 | #include <cmath>
  +++ |+#include <map>
    8 | typedef long long int ll;
a.cc:21:9: error: expected primary-expression before 'int'
   21 |     map<int, int> mp;
      |         ^~~
a.cc:32:15: error: 'mp' was not declared in this scope
   32 |         sum +=mp[i-a];
      |               ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define xrep(i,a,b) for(int i=int(a);i<int(b);++i)
using ll = long long;

const int INF = 100100100;

int main() {
    int N;
    cin >> N;
    vector<int> A;
    rep(i, N+1) {
        if(i==0) {
            A.push_back(INF);
            continue;
        }
        int a;
        cin >> a;
        A.push_back(a);
    }
    int cnt = 0;
    xrep(i, 1, N+1) {
        for(int j=i; j<N+1; ++j) {
            if(abs(A[i]+A[j])==j-i) {
                ++cnt;
            }
        }
    }
    cout << cnt << endl;

    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:32:14: error: expected '}' at end of input
   32 |     return 0;
      |              ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
   int n; cin >> n;
   vector<ll> data(n);
   map<ll,ll> map1, map2;
    rep(i,n){
        cin >> data[i];
        map1[(i+1)+data[i]]++;
        map2[(i+1)-data[i]]++
    }
    int ans = 0;
    loop(i,1,n+1) if(map1[i]==map[i]) ans += map1[i];
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: expected ';' before '}' token
   20 |         map2[(i+1)-data[i]]++
      |                              ^
      |                              ;
   21 |     }
      |     ~                         
a.cc:23:34: error: missing template arguments before '[' token
   23 |     loop(i,1,n+1) if(map1[i]==map[i]) ans += map1[i];
      |                                  ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iomanip>
# define M_PIl        3.141592653589793238462643383279502884
#define faster       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

typedef long long ll;
typedef long double ld;

int main(){
  ll n; cin >> n;
  vector<ll> arr(n);
  map<ll,ll> m;
  for(ll i=0;i<n;i++){
    cin >> arr[i];
    if((i+arr[i])<=n){
      map[i+arr[i]]++;
    }
  }
  ll ans=0;
  for(ll i=0;i<n;i++){
    if(i-arr[i]>0){
      ans+=map[i-arr[i]];
    }
  }
  cout << ans;
}

Compiler output:
a.cc:10:10: warning: "M_PIl" redefined
   10 | # define M_PIl        3.141592653589793238462643383279502884
      |          ^~~~~
In file included from /usr/include/c++/14/cmath:47,
                 from a.cc:3:
/usr/include/math.h:1157:10: note: this is the location of the previous definition
 1157 | # define M_PIl          3.141592653589793238462643383279502884L /* pi */
      |          ^~~~~
a.cc: In function 'int main()':
a.cc:24:12: error: expected ']' before '+' token
   24 |       map[i+arr[i]]++;
      |            ^
      |            ]
a.cc:24:20: error: expected initializer before '++' token
   24 |       map[i+arr[i]]++;
      |                    ^~
a.cc:24:20: error: expected ';' before '++' token
a.cc:30:15: error: missing template arguments before '[' token
   30 |       ans+=map[i-arr[i]];
      |               ^
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

#define MAX_SIZE (200001)
#define debug(x) (cout << # x ": " << x << endl)
#define ll long long int
#define repeat(n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()

int main() {
    int n;
    cin >> n;

    int mf[MAX_SIZE], pf[MAX_SIZE];
    memset(mf, 0, sizeof(int) * MAX_SIZE);
    memset(pf, 0, sizeof(int) * MAX_SIZE);

    repeat(n + 1) {
        if (i == 0) continue;
        int a;
        cin >> a;
        if (a > MAX_SIZE) continue;
        if (0 < i - a && i - a <= MAX_SIZE) {
            ++mf[i - a];
        }
        if (i + a <= MAX_SIZE) {
            ++pf[i + a];
        }
    }

    int res = 0;

    repeat(MAX_SIZE) {
        if (mf[i] > 0 && pf[i] > 0) {
            res += mf[i] * pf[i];
        }
    }

    cout << res;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'memset' was not declared in this scope
   21 |     memset(mf, 0, sizeof(int) * MAX_SIZE);
      |     ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <vector>
  +++ |+#include <cstring>
    7 |
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define int long long;
int main()
{
    int n, ans = 0;
    cin >> n;
    map<int, int> mp;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin >> x;
 
        ans += mp[i-x];
 
        mp[i+x]++;
    }
 
    cout << ans;
 
    return 0;
}


Compiler output:
a.cc:5:18: error: declaration does not declare anything [-fpermissive]
    5 | #define int long long;
      |                  ^~~~
a.cc:6:1: note: in expansion of macro 'int'
    6 | int main()
      | ^~~
a.cc:6:5: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | int main()
      |     ^~~~
a.cc: In function 'int main()':
a.cc:5:18: error: declaration does not declare anything [-fpermissive]
    5 | #define int long long;
      |                  ^~~~
a.cc:8:5: note: in expansion of macro 'int'
    8 |     int n, ans = 0;
      |     ^~~
a.cc:8:9: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 |     int n, ans = 0;
      |         ^
      |         yn
a.cc:8:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
    8 |     int n, ans = 0;
      |            ^~~
      |            abs
a.cc:5:18: error: wrong number of template arguments (1, should be at least 2)
    5 | #define int long long;
      |                  ^~~~
a.cc:10:9: note: in expansion of macro 'int'
   10 |     map<int, int> mp;
      |         ^~~
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:10:12: error: expected primary-expression before ',' token
   10 |     map<int, int> mp;
      |            ^
a.cc:5:13: error: expected primary-expression before 'long'
    5 | #define int long long;
      |             ^~~~
a.cc:10:14: note: in expansion of macro 'int'
   10 |     map<int, int> mp;
      |              ^~~
a.cc:10:17: error: expected primary-expression before '>' token
   10 |     map<int, int> mp;
      |                 ^
a.cc:10:19: error: 'mp' was not declared in this scope
   10 |     map<int, int> mp;
      |                   ^~
a.cc:5:18: error: declaration does not declare anything [-fpermissive]
    5 | #define int long long;
      |                  ^~~~
a.cc:11:9: note: in expansion of macro 'int'
   11 |     for(int i=1;i<=n;i++)
      |         ^~~
a.cc:11:13: error: 'i' was not declared in this scope
   11 |     for(int i=1;i<=n;i++)
      |             ^
a.cc:11:21: error: expected ')' before ';' token
   11 |     for(int i=1;i<=n;i++)
      |        ~            ^
      |                     )
a.cc:11:22: error: 'i' was not declared in this scope
   11 |     for(int i=1;i<=n;i++)
      |                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e5+5;
map<ll,ll> mp;
 int a[maxn];
 ll ans;
int main()
{
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
for(int  i=1;i<=n;i++)
   if(i-a[i]>0) mp[i-a[i]]++;
for(int  i=1;i<=n;i++)
   if(mp[i+a[i]])ans+= mp[i+a[i]];
cout<<ans;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:6: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 | cin>>n;
      |      ^
      |      yn
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>

using namespace std;

const int max_n = 200000;
// const int max_ai = 1000000000;
int n;
int a[max_n + 1];

int main(){
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];

  // int map[max_n+1] = {0};
  // vector<int> map(max_n+1, 0);
  map<long long, int> M;

  int counter = 0;
  for(int i = 0; i < n; i++){
    counter += M[i-a[i]];
    M[i+a[i]] ++;
  }

  cout << counter << endl;


  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:3: error: 'map' was not declared in this scope
   20 |   map<long long, int> M;
      |   ^~~
a.cc:6:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    5 | #include <cstring>
  +++ |+#include <map>
    6 | 
a.cc:20:7: error: expected primary-expression before 'long'
   20 |   map<long long, int> M;
      |       ^~~~
a.cc:24:16: error: 'M' was not declared in this scope
   24 |     counter += M[i-a[i]];
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    ll N; cin >> N;
    map<ll, ll> mp1, mp2;
    ll A;
    for(int i=0;i<N;i++)
    {
        cin >> A;
        mp1[i + A]++; mp2[i - A]++;
        st.insert(i - A)
    }

    ll ans = 0;

    for(auto [key, value] : mpp)
    {
        ans += mp1[key] * mp2[key];
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'st' was not declared in this scope; did you mean 'std'?
   14 |         st.insert(i - A)
      |         ^~
      |         std
a.cc:19:29: error: 'mpp' was not declared in this scope; did you mean 'mp2'?
   19 |     for(auto [key, value] : mpp)
      |                             ^~~
      |                             mp2
Language: C++

#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

const int MAXN = 200010;

ll n;
ll a[MAXN];

void solve() {
  vector<ll> v;
  for (int i=0;i<n;i++) {
    v.push_back(i - a[i]);
  }
  sort(v.begin(), v.end());

  ll cnt = 0;
  for (int i=0;i<n;i++) {
    auto lower = lower_bound(v.begin(), v.end(), a[i] + i);
    auto upper = upper_bound(v.begin(), v.end(), a[i] + i);
    cnt += upper - lower;
  }
  cout << cnt << endl;
}

int main() {
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> a[i];
  }
  solve();
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:17:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |   sort(v.begin(), v.end());
      |   ^~~~
      |   short
a.cc:22:18: error: 'upper_bound' was not declared in this scope
   22 |     auto upper = upper_bound(v.begin(), v.end(), a[i] + i);
      |                  ^~~~~~~~~~~
Language: C++

#include <iostream>

int main()
{
    int N;
    std::cin >> N;
    int A[N];
    for(int i = 0; i < N; i++) std::cin >> A[i];
    int count = 0;
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < i; j++)
        {
            if(i - j == A[i] + A[j]) count++;
        }
    }
    std::cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |     std::cout << count << endl;
      |                           ^~~~
      |                           std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>

int main()
{
    int N;
    std::cin >> N;
    int A[N];
    for(int i = 0; i < N; i++) cin >> A[i];
    int count = 0;
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < i; j++)
        {
            if(i - j == A[i] + A[j]) count++;
        }
    }
    std::cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:32: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |     for(int i = 0; i < N; i++) cin >> A[i];
      |                                ^~~
      |                                std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:17:27: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |     std::cout << count << endl;
      |                           ^~~~
      |                           std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: Java

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Long N =Long.parseLong(sc.next());
        long[] l = new long[N];
        for(int i = 0 ;i < N ; i++){
            l[i] = Long.parseLong(sc.next());
        }
        Map<Long,Long> m = new HashMap<Long,Long>();
        long total = 0;
        for(int i = 0 ;i < N ; i++){
            if(m.containsKey(i+1-l[i])){
                total += m.get(i+1-l[i]);
            }
            if(m.containsKey(l[i]+1+i)){
                m.put(l[i]+1+i, m.get(l[i]+1+i)+1);
            }else{
                m.put(l[i]+1+i, 1l);
            }
        }
        System.out.println(total);
    }
}

Compiler output:
Main.java:9: error: incompatible types: Long cannot be converted to int
        long[] l = new long[N];
                            ^
1 error
Language: C

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
#define G() Cr = getchar()
#define LL long long
int Xr; char Cr;
inline int rd() {
	Xr = 0, G();
	while(Cr < '0' || Cr > '9') G();
	while(Cr >= '0' && Cr <= '9') Xr = (Xr<<1) + (Xr<<3) + (Cr&15), G();
	return Xr;
}
#define MAX_N 200005
int n;
int va[MAX_N];
map<int,int>mp;
LL ans;
int main() { 
	n = rd();
	for(int i = 1; i <= n; i++) {
		va[i] = rd();
		ans += mp[i-va[i]];
		mp[va[i]+i]++;
	}
	cout<<ans;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<map>
#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;
using ll = long long int;

int main(void) {
    int n, a; cin >> n;
    map<int, int> L, R;
    rep(i, n) {
        cin >> a;
        L[i + a]++;
        R[i - a]++;
    }
    int p = 0;
    for(auto itr = L.begin()->first; itr != L.end()->first; x++) {
        p += itr->second * R[i->first];
    }
    cout << p << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:61: error: 'x' was not declared in this scope
   17 |     for(auto itr = L.begin()->first; itr != L.end()->first; x++) {
      |                                                             ^
a.cc:18:17: error: base operand of '->' is not a pointer
   18 |         p += itr->second * R[i->first];
      |                 ^~
a.cc:18:30: error: 'i' was not declared in this scope
   18 |         p += itr->second * R[i->first];
      |                              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=200005;
ll a[maxn];
ll l[maxn],r[maxn];
ll cnt[100030003];
ll cnt2[100030003];
int main(){
	int n;ll ma=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		l[i]=i+a[i];
		r[i]=i-a[i];
		cnt[l[i]]++;
		if(r[i>0) cnt2[ir[i]+;
		ma=max(l[i],ma);
	}
	ll ans=0;
	for(ll i=1;i<=ma;i++){
		ans+=cnt[i]*cnt2[i];
	}
	printf("%lld\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: expected ']' before ')' token
   17 |                 if(r[i>0) cnt2[ir[i]+;
      |                         ^
      |                         ]
a.cc:17:32: error: 'ir' was not declared in this scope; did you mean 'i'?
   17 |                 if(r[i>0) cnt2[ir[i]+;
      |                                ^~
      |                                i
a.cc:17:38: error: expected primary-expression before ';' token
   17 |                 if(r[i>0) cnt2[ir[i]+;
      |                                      ^
a.cc:17:38: error: expected ']' before ';' token
   17 |                 if(r[i>0) cnt2[ir[i]+;
      |                                      ^
      |                                      ]
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=200005;
ll a[maxn];
ll l[maxn],r[maxn];
ll cnt[1000300030];
ll cnt2[1000300030];
int main(){
	int n;int ma=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		l[i]=i+a[i];
		r[i]=i-a[i];
		cnt[l[i]]++;
		if(r[i]>0) cnt2[r[i]]++;
		ma=max(l[i],r[i]);
	}
	ll ans=0;
	for(int i=1;i<=ma;i++){
		ans+=cnt[i]*cnt2[i];
	}
	printf("%lld\n",ans);
}

Compiler output:
/tmp/ccBsdHLX.o: in function `main':
a.cc:(.text+0x15c): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt2' defined in .bss section in /tmp/ccBsdHLX.o
a.cc:(.text+0x173): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt2' defined in .bss section in /tmp/ccBsdHLX.o
a.cc:(.text+0x203): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt2' defined in .bss section in /tmp/ccBsdHLX.o
collect2: error: ld returned 1 exit status
Language: C

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9+7);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    a %= mod;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}

vector<ll> FactorialInv, Factorial;

void init_combination(ll MAX){
    Factorial.resize(MAX + 1);
    FactorialInv.resize(MAX + 1);
    Factorial[0] = 1;
    for(int i = 1; i <= MAX; i++){
        Factorial[i] = Factorial[i - 1] * i % mod;
    }
    FactorialInv[MAX] = power(Factorial[MAX], mod - 2);
    for(ll i = MAX - 1; i >= 0; i--) {
        FactorialInv[i] = FactorialInv[i+1] * (i+1) % mod;
    }
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    if(b < 0) return 0;
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}

//modの値の確認をすること
int main(){
    ll n,ans = 0;
    map<ll,ll> m;
    cin >> n;
    vector<ll> a(n);
    rep0(i, n){
        cin >> a[i];
        ++m[a[i] + i];
    }
    rep0(i, n)ans += m[i - a[i]];
    pf(ans);
    return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(){
  int a,b,d;
  cin>>a;
  vector<int> data;
  for(int i=0;i<a;i++){
    cin>>b;
    data.push_back(b);
  }
  d=0;
  for(int i=0;i<a-1;i++){
    for(int j=i+1;j<a;j++){
      if(j+1-a[j]<=0)break;
      else if(data[i]+data[j]==abs(i-j) and i!=j)d+=1;
    }
  }
  cout<<d<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:15: error: invalid types 'int[int]' for array subscript
   17 |       if(j+1-a[j]<=0)break;
      |               ^
Language: C++

#include <iostream>
#include <map>

int main () {
    int64_t N;
    std::map<int64_t,int64_t> test_map;
    std::cin >> N;
    int count = 0;
        
    for (int64_t i=0; i<N; i++) {
        int64_t height;
        std::cin >> height;
        // i - j = height[i] + height[j]
        // i - height[i] = j + height[j]
        count += test_map[i+1-height];
        test_map[i+1+height] = test_map[i+1+height] + 1
    }
    std::cout << count << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:56: error: expected ';' before '}' token
   16 |         test_map[i+1+height] = test_map[i+1+height] + 1
      |                                                        ^
      |                                                        ;
   17 |     }
      |     ~
Language: Java

import java.util.Scanner;
public class Main {
 	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int[] vis = new int[2000001];
		int N = input.nextInt();
		long cnt = 0;
		for (int i = 1; i <= N; i++)
			int x = input.nextInt();
			if (i+x<=200000) vis[i+x]++;
			if (i-x>=0) cnt+=vis[i-x];
		System.out.println(cnt);
	}
}

Compiler output:
Main.java:9: error: variable declaration not allowed here
			int x = input.nextInt();
			    ^
1 error
Language: C++

map<int,int> mp;
const maxn=2e5+5;
int n,a[maxn];
ll ans;
int main()
{
  
  cin>>n;
  for(int i=1;i<=n;i++)
  {
  	  cin>>a[i];
  	  if(i-a[i]>0)mp[i-a[i]]++;
  }
  for(int i=1;i<=n;i++)
  {
  	if(mp[i+a[i]]) ans++;
  }
  cout<<ans;
return 0;
}

Compiler output:
a.cc:1:1: error: 'map' does not name a type
    1 | map<int,int> mp;
      | ^~~
a.cc:2:7: error: 'maxn' does not name a type
    2 | const maxn=2e5+5;
      |       ^~~~
a.cc:3:9: error: 'maxn' was not declared in this scope
    3 | int n,a[maxn];
      |         ^~~~
a.cc:4:1: error: 'll' does not name a type
    4 | ll ans;
      | ^~
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin>>n;
      |   ^~~
a.cc:11:16: error: 'a' was not declared in this scope
   11 |           cin>>a[i];
      |                ^
a.cc:12:23: error: 'mp' was not declared in this scope
   12 |           if(i-a[i]>0)mp[i-a[i]]++;
      |                       ^~
a.cc:16:12: error: 'mp' was not declared in this scope
   16 |         if(mp[i+a[i]]) ans++;
      |            ^~
a.cc:16:17: error: 'a' was not declared in this scope
   16 |         if(mp[i+a[i]]) ans++;
      |                 ^
a.cc:16:24: error: 'ans' was not declared in this scope
   16 |         if(mp[i+a[i]]) ans++;
      |                        ^~~
a.cc:18:3: error: 'cout' was not declared in this scope
   18 |   cout<<ans;
      |   ^~~~
a.cc:18:9: error: 'ans' was not declared in this scope
   18 |   cout<<ans;
      |         ^~~
Language: Java

import java.util.Scanner;

public class Q5NewAttempt {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		boolean[] VL = new boolean[200001];
		boolean[] VR = new boolean[200001];
		int[] Lcnt = new int[200001];
		int[] Rcnt = new int[200001];
		long cnt = 0;
		for (int i = 1; i <= N; i++) {
			int x = input.nextInt();
			int L = x+i;
			int R = i-x;
			if (L<200000) {
				VL[L]=true;
				Lcnt[L]++;
			} 
			if (R>0) {
				VR[R]=true;
				Rcnt[R]++;
			} 
			if (L<200000&&R>=0) {
				if (VL[R]) cnt+=Lcnt[R];
				if (VR[L]) cnt+=Rcnt[L];
			}
		}
		System.out.println(cnt);
	}
}

Compiler output:
Main.java:3: error: class Q5NewAttempt is public, should be declared in a file named Q5NewAttempt.java
public class Q5NewAttempt {
       ^
1 error
Language: Java

import java.io.*;
import java.math.*;
import java.util.*;
public class Q5 {

	public static void main(String[] args) {
		long mod = (long)(1e9+7);
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		long[] H = new long[N+1];
		long cnt = 0;
		long max = 0;
		for (int i = 1; i <= N; i++) {
			H[i] = input.nextLong();
			max = Math.max(H[i], max);
		}
		//Try O(N^2) Brute Force first
		for (int i = 1; i <= N; i++) {
			if (H[i]+i+1<=N) {
				int S = (int)(H[i]+i+1);
				//System.out.println(S);
				for (int j = S; j <= N; j++) {
					if (j-i==H[i]+H[j]) cnt++;
					if (j-i>max+H[i]) break;
				}
			}
		}
		System.out.println(cnt);
	}
}

Compiler output:
Main.java:4: error: class Q5 is public, should be declared in a file named Q5.java
public class Q5 {
       ^
1 error
Language: C++

#include <bits/stdc++>
using namespace std;
#define rep(i,n) for(int i=0; i < n; i++)

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> b(n), c(n);
  rep(i, n) b[i] = a[i] - i;
  rep(i, n) c[i] = a[i] + i;
  long long ans = 0;
  rep(i, n){
  	ans += b[i]*c[i];
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:1:10: fatal error: bits/stdc++: No such file or directory
    1 | #include <bits/stdc++>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
const ll mod=2019 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

int main() {
   
     int n ;
     cin >> n;
   vector<int> A(n) ;
   rep(i,n) cin>> A[i] ;
   map<int,int> mp ;
   ll ans =0 ;
   rep(i,n){
   int gap= i-A[i] ;
   mp[gap] ++ ;
   }
   rep(i,n){
     int sum =i+A[i] ;
     ans += mp[sum]
   }
   cout<<ans <<endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:27:20: error: expected ';' before '}' token
   27 |      ans += mp[sum]
      |                    ^
      |                    ;
   28 |    }
      |    ~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
//using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    map<int, int> mp;
    ll ans = 0;
    rep(j,n) {
        int sa = j - a[j];
        ans += mp[sa];
        int wa = j + a[j];
        mp[wa]++;
    }
    cout << ans << endl
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: expected ';' before 'return'
   20 |     cout << ans << endl
      |                        ^
      |                        ;
   21 |     return 0;
      |     ~~~~~~
Language: C++

// JAI SHREE RAM
#pragma GCC optimize("O3")
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define loop for(int i=0;i<n;i++)
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max3(a,max(b,c),d)
#define max5(a,b,c,d,e) max4(a,max(b,c),d,e)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min3(a,min(b,c),d)
#define min5(a,b,c,d,e) min4(a,min(b,c),d,e)
#define sec second
#define fir first
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
// #define all(a) (a).begin(),(a).end()
#define vec vector<int>
#define M_PI           3.14159265358979323846  /* pi */
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fast
	ll n, x;
	cin >> n;
	map<ll, ll> mp;
	ll res=0;
	rep(i, n)
	{
		cin >> x;
		// i-x
		// i+x
		res=res+mp[i-x];
		mp[i+x]++;
	}
	cout<<res<<endl;
	return 0;
}
// JAI SHREE RAM
#pragma GCC optimize("O3")
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define loop for(int i=0;i<n;i++)
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max3(a,max(b,c),d)
#define max5(a,b,c,d,e) max4(a,max(b,c),d,e)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min3(a,min(b,c),d)
#define min5(a,b,c,d,e) min4(a,min(b,c),d,e)
#define sec second
#define fir first
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
// #define all(a) (a).begin(),(a).end()
#define vec vector<int>
#define M_PI           3.14159265358979323846  /* pi */
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fast
	ll n, x;
	cin >> n;
	map<ll, ll> mp;
	ll res=0;
	rep(i, n)
	{
		cin >> x;
		// i-x
		// i+x
		res=res+mp[i-x];
		mp[i+x]++;
	}
	cout<<res<<endl;
	return 0;
}


Compiler output:
a.cc:80:5: error: redefinition of 'int main()'
   80 | int main() {
      |     ^~~~
a.cc:30:5: note: 'int main()' previously defined here
   30 | int main() {
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long ling ll;
int main(){
  ll n,a,ans=0;
  map<ll,ll> mp,mp2;
  cin>>n;
  rep(i,n){
     cin>>a;
     mp[-(a+i+1)]++; 
     mp2[a-(i+1)]++;
  }
  for(auto itr : mp)
    ans+=mp2[itr.first]*itr.second;
  cout<<ans;
  return 0;
}


Compiler output:
a.cc:4:19: error: expected initializer before 'll'
    4 | typedef long ling ll;
      |                   ^~
a.cc: In function 'int main()':
a.cc:6:3: error: 'll' was not declared in this scope
    6 |   ll n,a,ans=0;
      |   ^~
a.cc:7:12: error: template argument 3 is invalid
    7 |   map<ll,ll> mp,mp2;
      |            ^
a.cc:7:12: error: template argument 4 is invalid
a.cc:8:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 |   cin>>n;
      |        ^
      |        yn
a.cc:10:11: error: 'a' was not declared in this scope
   10 |      cin>>a;
      |           ^
a.cc:14:18: error: 'begin' was not declared in this scope
   14 |   for(auto itr : mp)
      |                  ^~
a.cc:14:18: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:14:18: error: 'end' was not declared in this scope
   14 |   for(auto itr : mp)
      |                  ^~
a.cc:14:18: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:15:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |     ans+=mp2[itr.first]*itr.second;
      |     ^~~
      |     abs
a.cc:16:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   cout<<ans;
      |         ^~~
      |         abs
Language: C++

#include <iostream>
#include <math.h>
using namespace std;

int main() {
	//人数の入力
	int i=0,x,sum=0;
	cin >> x;
    int *p;
	p= new int a[x];
	while (i < x) {
		cin >> a[i];
		i++;
	}

	for (int i = 0; i < x; i++) {
		for (int j = i; j < x; j++) {
			if (abs(j - i) == a[i] + a[j]) sum++;
		}
	}

	cout << sum;
    delete[] p;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: expected ';' before 'a'
   10 |         p= new int a[x];
      |                   ^~
      |                   ;
a.cc:12:24: error: 'a' was not declared in this scope
   12 |                 cin >> a[i];
      |                        ^
a.cc:18:43: error: 'a' was not declared in this scope
   18 |                         if (abs(j - i) == a[i] + a[j]) sum++;
      |                                           ^
Language: C++

#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

#define ifr(i,n) for(int i=(n)-1;i>=0;--i)

signed main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    unordered_map<int, int> B(N);
    REP(i, N){
        cin >> A[i];
    }

    //int a, b;
    int ans = 0;

    REP(j,N){
        i = N-j;
        ans+=B[A[i]+i];
        B[+i-A[i]]++;
    }

    cout << ans << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:9: error: 'i' was not declared in this scope
   63 |         i = N-j;
      |         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  long n;
  unordered_map<int, int> m;
  int res = 0;
  cin >> n;
  vector<int> nums(n);
  
  for(int i = 0; i < n; i++){
  	cin >> nums[i];
    m[i] = nums[i];
  }
  
  for(int i = 0; i < n; i++){
  	for(int j = i + 1; j < n; j++){
    	if(j - i == abs(m[i] = m[j])res++;
    }
  }
  
  cout << res << endl;
  
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:37: error: expected ';' before 'res'
   19 |         if(j - i == abs(m[i] = m[j])res++;
      |                                     ^~~
      |                                     ;
a.cc:20:5: error: expected primary-expression before '}' token
   20 |     }
      |     ^
a.cc:19:43: error: expected ')' before '}' token
   19 |         if(j - i == abs(m[i] = m[j])res++;
      |           ~                               ^
      |                                           )
   20 |     }
      |     ~                                      
a.cc:20:5: error: expected primary-expression before '}' token
   20 |     }
      |     ^