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

n = int(input())
a = list(map(int, input().split()))

wa = {}
ans = 0
for i in range(len(a)):
    temp_wa = (i + 1) + a[i]
    if temp_wa in wa.keys():
        wa[temp_wa]+=1
    else:
        wa[temp_wa] = 1

    temp_sa = (i+1) - a[i]
    if temp_sa in wa.keys():
        ans += wa[temp_sa]

print(ans)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
a.cc:5:1: error: 'ans' does not name a type
    5 | ans = 0
      | ^~~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n;cin>>n;
  map<int,int> m;
  int c=0;
  for(int i=0;i<n;i++){
    int ai;cin>>ai;
    c+=m[i-ai];
    m[i+ai]++;
  }
  cout<<c<<endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'map' was not declared in this scope
    5 |   map<int,int> m;
      |   ^~~
a.cc:2:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    1 | #include<iostream>
  +++ |+#include <map>
    2 | using namespace std;
a.cc:5:7: error: expected primary-expression before 'int'
    5 |   map<int,int> m;
      |       ^~~
a.cc:9:8: error: 'm' was not declared in this scope
    9 |     c+=m[i-ai];
      |        ^
Language: C++

/*input
32
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5
*/

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

const int MAX_N = 200101;
int B[MAX_N];
int C[MAX_N];

int main() {
    int N, A[MAX_N];
    cin >> N;
    rep(i, N) cin >> A[i];
    // int B[MAX_N];
    // int D[MAX_N];
    rep(i, N) {
        B[i] = -A[i]+i;
        C[i] = A[i]+i;
    }
    sort(B, B+N);
    sort(C, C+N);
     ans = 0;
    rep(i, N) {
        ans += upper_bound(C, C+N, B[i])-lower_bound(C, C+N, B[i]);
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |      ans = 0;
      |      ^~~
      |      abs
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cstdio>

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


#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)

auto sumdig(ll num) {
	ll dig, sum;
	sum = 0;
	while (num) {
		dig = num % 10;
		sum = sum + dig;
		num = num / 10;
	}
	return sum;
}




int main() {

	int n;
	vector<int> a;
	cin >> n;
	a.resize(n);


	rep(i, 0, n) {
		scanf_s("%d", &a[i]);
	}
	int ans = 0;
	rep(i, 0, n) {
		rep(j, i+2, n) {
			if ((abs(i - j) == a[i] + a[j])) {
				ans += 1;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   42 |                 scanf_s("%d", &a[i]);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  cin >> N;
  
  vector<int> T(n,0);
  
  for(int i=0; i<N; i++){
    cin >> T.at(i);
  }
  
  int count=0;
  
  for(int i=0; i<N-1; i++){
    for(int j=0; j<N-i-1; j++){
      if(T.at(i)+T.at(j+i+1)=j+1) count +=1;
    }
  }
  
  cout << count << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: 'n' was not declared in this scope
    8 |   vector<int> T(n,0);
      |                 ^
a.cc:18:17: error: lvalue required as left operand of assignment
   18 |       if(T.at(i)+T.at(j+i+1)=j+1) count +=1;
      |          ~~~~~~~^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int n;
  cin >> n;
  
  vector<int> T(n,0);
  
  for(i=0; i<N; i++){
    cin >> T.at(i);
  }
  
  int count=0;
  
  for(i=0; i<N-1; i++){
    for(j=0; j<N-i-1; j++){
      if(T.at(i)+T.at(j+i+1)=j+1) count +=1;
    }
  }
  
  cout << count << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: 'i' was not declared in this scope
   10 |   for(i=0; i<N; i++){
      |       ^
a.cc:10:14: error: 'N' was not declared in this scope
   10 |   for(i=0; i<N; i++){
      |              ^
a.cc:16:7: error: 'i' was not declared in this scope
   16 |   for(i=0; i<N-1; i++){
      |       ^
a.cc:16:14: error: 'N' was not declared in this scope
   16 |   for(i=0; i<N-1; i++){
      |              ^
a.cc:17:9: error: 'j' was not declared in this scope
   17 |     for(j=0; j<N-i-1; j++){
      |         ^
Language: C++


// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a,b) memset(a, b, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;
int a[maxn];

int main(){
        _ios;
        int n; cin >> n;
        map<int,int>mp;
        int ans = 0;
        rep1(i,n){
            int x;cin>> x;
            ans+=mp[i-x];
            mp[i+x]++;
        }
        cout<<ans<<endl;


return 0;
}



Compiler output:
a.cc:35:17: error: macro "rep1" requires 3 arguments, but only 2 given
   35 |         rep1(i,n){
      |                 ^
a.cc:12:9: note: macro "rep1" defined here
   12 | #define rep1(i,a,b) for(int i=(a);i<=(b);++i)
      |         ^~~~
a.cc: In function 'int main()':
a.cc:35:9: error: 'rep1' was not declared in this scope
   35 |         rep1(i,n){
      |         ^~~~
Language: C++

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



int main()
{
  long long int a,b[200010],c[200010],d[200010];
  cin >> a;
	
  for(int i=0;i<a;i++)
    cin >> b[i];
    
      
 for(int i=0;i<a;i++){
  c[b[i]+i]++;
}
 for(int i=0;i<a;i++){
  d[b[i]-j]++;
}
  int ans = 0;
  for(int i=0;i<a;i++){
 ans += c[i]*d[i];
  }
  
  cout << ans << endl;
  
}
  
  
 
        
                             
                
  
                             
  
    }  
}
        
}      
        
 
  


Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: 'j' was not declared in this scope
   19 |   d[b[i]-j]++;
      |          ^
a.cc: At global scope:
a.cc:38:5: error: expected declaration before '}' token
   38 |     }
      |     ^
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
a.cc:41:1: error: expected declaration before '}' token
   41 | }
      | ^
Language: C++

#include <iostream>
#include <set>


using namespace std;
int main(){
	int N;
  	int A[200001];
  cin >> N;
  multiset<int> dif;
  for(int i=1; i<=N;i++){
   cin >> A[i]; 
    dif.insert(A[i]+i);
  }
	long count = 0;
  	for(int j=1;j<=N;j++){
		count+=dif.count(j-A[j]);
    }
  }
  cout << count <<endl;
  return 0;
}


Compiler output:
a.cc:20:3: error: 'cout' does not name a type
   20 |   cout << count <<endl;
      |   ^~~~
a.cc:21:3: error: expected unqualified-id before 'return'
   21 |   return 0;
      |   ^~~~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: Java

import java.util.*;
import java.util.Map.Entry;
import java.io.*;

public class temp {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

        int N = in.nextInt();
        int[] A = new int[N];
        
        for(int i=0;i<N;++i) {
            A[i]=in.nextInt();
        }

        int ans = 0;

        for(int i=0;i<N;++i) {
            for(int j=i+A[i]+1;j<N;++j) {
                if(A[i]+A[j]==j-i) {
                    ans+=1;
                }
            }
        }

        System.out.println(ans);

    }
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int N,x,p=0;
  vector<int> a;
  cin>> N;
  while(N--)
  {
    cin >> x;
    a.push_back(x);
  }
    
  
  for(int i=1;i<=N;i++)
  {
    for(int j=i+1;j<=N;j++)
    {
    if(abs(i-j)==a[i]+a[j]) p++;
    }
  }
}
  return 0;

Compiler output:
a.cc:23:3: error: expected unqualified-id before 'return'
   23 |   return 0;
      |   ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int N,x,p=0;
  vector<int> a;
  while(N--)
  {
    cin >> x;
    a.push_back(x);
  }
    
  
  for(int i=1;i<=N;i++)
  {
    for(int j=i+1;j<=N;j++)
    {
    if(abs(i-j)==a[i]+a[j]) p++;
    }
  }
}
  return 0;
      
    
    
    
    
  
  
  
  
  
  

Compiler output:
a.cc:22:3: error: expected unqualified-id before 'return'
   22 |   return 0;
      |   ^~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#define N 200000
typedef struct {
    long int value;
    int count;
} kv;

kv mmm[N];

void hash_clear(){
    for(i=0;i<N;i++){
        mmm[i].count=0;
        mmm[i].value=-1;
    }
}

void hash_inc(int a){
    int x=a%(N/2);
    while(mmm[x].value!=-1||mmm[x].value!=a){
        x++;
    }
    if (mmm[x].value==-1){
        mmm[x].value=a;
        mmm[x].count=1;
    }else{
        mmm[x].count++;
    }
}

int hash_getc(int a){
    int x=a%(N/2);
    int c=10;
    while(mmm[x].value==a){
        x++;
        c--;
        if(c==0) return(0);
    }
    return(mmm[x].count);
}


int main(){
    long int n;
    long int a[N];

    long int i,j;
    long int c;

    hash_clear();

    scanf("%ld",&n);
    for(i=0;i<n;i++){
        scanf("%ld",&a[i]);
    }

    c=0;
    for(i=0;i<n-1;i++){
        hash_inc(a[i]+i);
    }

    for(j=1;j<n;j++){            

            if(j-a[j]>=0) c+=hash_getc(j-a[j]);
    }

    printf("%ld\n",c);




}




Compiler output:
main.c: In function 'hash_clear':
main.c:12:9: error: 'i' undeclared (first use in this function)
   12 |     for(i=0;i<N;i++){
      |         ^
main.c:12:9: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		Map<Long, Integer> map = new HashMap<>();
		long count = 0;

		for (int i = 0; i < n; i++) {
			long saveme = sc.nextLong();

			long former = i - saveme;
			long latter = i + saveme;

			count += map.getOrDefault(former, 0);

			map.putIfAbsent(latter, 0);
			map.put(latter, map.get(latter) + 1);
		}

		sc.close();

		System.out.println(count);
	}
}

Compiler output:
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:8: error: cannot find symbol
		Map<Long, Integer> map = new HashMap<>();
		^
  symbol:   class Map
  location: class Main
Main.java:8: error: cannot find symbol
		Map<Long, Integer> map = new HashMap<>();
		                             ^
  symbol:   class HashMap
  location: class Main
4 errors
Language: C

#include <stdio.h>
#include <stdlib.h>
#define N 200000
typedef struct {
    long int value;
    int count;
} kv;

kv mmm[N];

hash_clear(){
    for(i=0;i<N;i++){
        mmm[i].count=0;
        mmm[i].value=-1;
    }
}

hash_inc(int a){
    int x=a%(N/2);
    while(mmm[x].value!=-1||mmm[x].value!=a){
        x++;
    }
    if (mmm[x].value==-1){
        mmm[x].value=a;
        mmm[x].count=1;
    }else{
        mmm[x].count++;
    }
}

hash_getc(int a){
    int x=a%(N/2);
    int c=10;
    while(mmm[x].value==a){
        x++;
        c--;
        if(c==0) return(0);
    }
    return(mmm[x].count);
}


int main(){
    long int n;
    long int a[N];

    long int i,j;
    long int c;

    hash_clear();

    scanf("%ld",&n);
    for(i=0;i<n;i++){
        scanf("%ld",&a[i]);
    }

    c=0;
    for(i=0;i<n-1;i++){
        hash_inc(a[i]+i);
    }

    for(j=1;j<n;j++){            

            if(j-a[j]>=0) c+=hash_getc(j-a[j]);
    }

    printf("%ld\n",c);




}




Compiler output:
main.c:11:1: error: return type defaults to 'int' [-Wimplicit-int]
   11 | hash_clear(){
      | ^~~~~~~~~~
main.c: In function 'hash_clear':
main.c:12:9: error: 'i' undeclared (first use in this function)
   12 |     for(i=0;i<N;i++){
      |         ^
main.c:12:9: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:18:1: error: return type defaults to 'int' [-Wimplicit-int]
   18 | hash_inc(int a){
      | ^~~~~~~~
main.c:31:1: error: return type defaults to 'int' [-Wimplicit-int]
   31 | hash_getc(int a){
      | ^~~~~~~~~
Language: C++

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
int main() {
	int n;
	cin >> n;
	vector<ll>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			if (j - i == a[i] + a[j])ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: 'll' was not declared in this scope
   10 |         vector<ll>a(n);
      |                ^~
a.cc:10:18: error: template argument 1 is invalid
   10 |         vector<ll>a(n);
      |                  ^
a.cc:10:18: error: template argument 2 is invalid
a.cc:12:25: error: invalid types 'int[int]' for array subscript
   12 |                 cin >> a[i];
      |                         ^
a.cc:17:39: error: invalid types 'int[int]' for array subscript
   17 |                         if (j - i == a[i] + a[j])ans++;
      |                                       ^
a.cc:17:46: error: invalid types 'int[int]' for array subscript
   17 |                         if (j - i == a[i] + a[j])ans++;
      |                                              ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  map<int,int> l;
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for(int i = 0; i < N; i++) {
    l.at(i + A.at(i))++;
  }
  int ans=0;
  for(int i = 0; i < N; i++) {
    ans += l(i - A.at(i));
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: no match for call to '(std::map<int, int>) (int)'
   17 |     ans += l(i - A.at(i));
      |            ~^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	map<int, int> mp;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		int x; cin >> x;
		ans += mp[id];
		mp[i + x]++;
	}
	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:27: error: 'id' was not declared in this scope; did you mean 'i'?
    9 |                 ans += mp[id];
      |                           ^~
      |                           i
Language: C++

#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric> // 最大公約数が使える
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9

int main(){
    int N;
    cin >> N;
    vector<pair<ll,ll>>A(N);
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        A[i] = make_pair(i,a);
    }
    map<ll,ll>B;
    for (int i = 0; i < N; i++)
        {
            int u = A[i].first + A[i].second;
            B[u]++ ; //  uが前のll,B[u]が後ろのll
        }
    int ans =0;
    for (int j = 0; j < N; i++)
    {
        int t = A[j].first - A[j].second;
        ans += B[t];
    }
    cout << ans <<endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:28: error: 'i' was not declared in this scope
   36 |     for (int j = 0; j < N; i++)
      |                            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+20;
int n;
map<int,int>m;
vector<long long>heights(N);
long long count;
int main(){
  cin>>n;
 
  for(int i=1;i<=n;i++){
      cin>>heights[i];
       count+= m[heights[i]-i];
     m[-i-heights[i]]++;
  }

  cout<<count;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: reference to 'count' is ambiguous
   13 |        count+= m[heights[i]-i];
      |        ^~~~~
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:7:11: note:                 'long long int count'
    7 | long long count;
      |           ^~~~~
a.cc:17:9: error: reference to 'count' is ambiguous
   17 |   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:7:11: note:                 'long long int count'
    7 | long long count;
      |           ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+20;
int n;
map<int,int>m;
vector<int>heights(N);
long long count;
int main(){
  cin>>n;
 
  for(int i=1;i<=n;i++){
      cin>>heights[i];
       count+= m[heights[i]-i];
     m[-i-heights[i]]++;
  }

  cout<<count;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: reference to 'count' is ambiguous
   13 |        count+= m[heights[i]-i];
      |        ^~~~~
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:7:11: note:                 'long long int count'
    7 | long long count;
      |           ^~~~~
a.cc:17:9: error: reference to 'count' is ambiguous
   17 |   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:7:11: note:                 'long long int count'
    7 | long long count;
      |           ^~~~~
Language: C++

#include <iostream>

using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i,j;
    cin >> n;
    int* a = new int[n+1];
    for(i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int ans = 0;
	for(i=1; i<n; i++) {
		for (j = i+a[i]+1; j <= n; j++) {
			if(a[i]+a[j]==j-i) {
				ans++;
			}
		}
	}
	cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:12: error: 'n' was not declared in this scope
    8 |     cin >> n;
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+20;
int n;
map<int,int>m;
vector<int>heights(N);
int count;
int main(){
  cin>>n;
 
  for(int i=1;i<=n;i++){
      cin>>heights[i];
       count+= m[heights[i]-i];
     m[-i-heights[i]]++;
  }

  cout<<count;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: reference to 'count' is ambiguous
   13 |        count+= m[heights[i]-i];
      |        ^~~~~
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:7:5: note:                 'int count'
    7 | int count;
      |     ^~~~~
a.cc:17:9: error: reference to 'count' is ambiguous
   17 |   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:7:5: note:                 'int count'
    7 | int count;
      |     ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+20;
int n;
 map<int,int>m;
 vector<int>heights(N);
 int count= 0;
int main(){
  cin>>n;
 
  for(int i=1;i<=n;i++){
      cin>>heights[i];
       count+= m[heights[i]-i];
     m[-i-heights[i]]++;
  }

  cout<<count;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: reference to 'count' is ambiguous
   13 |        count+= m[heights[i]-i];
      |        ^~~~~
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:7:6: note:                 'int count'
    7 |  int count= 0;
      |      ^~~~~
a.cc:17:9: error: reference to 'count' is ambiguous
   17 |   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:7:6: note:                 'int count'
    7 |  int count= 0;
      |      ^~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;

// E
int main(){FIN

	int N;
	cin >> n;
	vll a(n);
	vector<pair<ll, ll>> cnt(n);
	REP(i,n){
		cin >> a[i];
	}
	REP(i,n){
		ll tmp1 = i - a[i], tmp2 = i + a[i];
		if (tmp1 >= 0) {
			cnt[tmp1].second++;
		}
		if (tmp2 < n) {
			cnt[tmp2].first++;
		}
	}
 
	ll ans = 0;
	REP(i,n){
		ll tmp1 = cnt[i].first, tmp2 = cnt[i].second;
		ans += tmp1 * tmp2;
	}
	cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:16: error: 'n' was not declared in this scope
   23 |         cin >> n;
      |                ^
Language: C++

#include <iostream>

using namespace std;
main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i,j;
    cin >> n;
    int a[n+1];
    for(i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int ans = 0;
	for(i=1; i<n; i++) {
		for (j = i+a[i]+1; j <= n; j++) {
			if(a[i]+a[j]==j-i) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:8:12: error: 'n' 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:15:28: error: 'a' was not declared in this scope
   15 |                 for (j = i+a[i]+1; j <= n; j++) {
      |                            ^
Language: C

#include <stdio.h>
typedef long long ll;
typedef struct hoge{
    ll A;
    ll left;
    ll right;
}height;

int main(){
  ll N,ans=0;
  scanf("%lld",&N);
  height H[N];
  for(ll i = 0;i<N;i++){
    scanf("%lld",&H[i].A);
    H[i].left = i-H[i].A;
    H[i].right = i+H[i].A;
  }
  for(ll i = 0;i<N;i++) for(ll j = N-1;j>=0;j--) if(H[i].right == H[j].left) ans++;
  printf("%lld\n",ans);
  return 0;

Compiler output:
main.c: In function 'main':
main.c:20:3: error: expected declaration or statement at end of input
   20 |   return 0;
      |   ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
const ll N=2e5+3;
map<ll,ll>mp;
ll a[N];
ll main()
{
    ft
    ll t,i,j,n,m,l,r=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        mp[i-a[i]]++;
    }
    for(i=1;i<=n;i++)
    {
        r+=(mp[i+a[i]]);
    }
    cout<<r<<"\n";
    return 0;
}



Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C

#include <cstdio>
#include <algorithm>
using std::sort;
using std::lower_bound;
using std::upper_bound;

const int MAXN=200003;
int a[MAXN],L[MAXN],R[MAXN];

int main(void)
{
    int i,N;
    scanf("%d",&N);
    for(i=0;i<N;i++)
    {
        scanf("%d",a+i);
        L[i] = i+1+a[i];
        R[i] = (i+1)-a[i];
    }
    sort(R,R+N);
    int ret = 0,lwbd,upbd;
    for(i=0;i<N;i++)
    {
        lwbd = lower_bound(R,R+N,L[i]) - &R[0];
        upbd = upper_bound(R,R+N,L[i]) - &R[0];
        
        ret+=upbd-lwbd;

    }
    printf("%d\n",ret);
    return 0;
}



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

//
// Created by yamunaku on 2020/05/03.
//

#include <bits/stdc++.h>

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];
    map<int, int> mp;
    ll ans = 0;
    rep(i, n){
        ans += mp[i - a[i]];
        mp[i + a[i]]++;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'll' was not declared in this scope
   17 |     ll ans = 0;
      |     ^~
a.cc:19:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |         ans += mp[i - a[i]];
      |         ^~~
      |         abs
a.cc:22:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include<algorithm>
using namespace std;
int n,pp,sign,a[200005],g,h;
long long ans=0;
struct tt{
	int id,num;
} b[200005];
bool pd(tt x,tt y)
{
	if ((x.num<y.num)|| (x.num==y.num && x.id<y.id))return true;
	return false;
}
int search1(int t,int i,int j){
	int mid=(i+j)/2;
	if (j<i) return -1;
	if (b[mid].num==t&&b[mid-1].num!=t) return mid;
	if ((b[mid].num>t)||(b[mid].num==t&&b[mid-1].num==t)) return search1(t,i,mid-1);
	if (b[mid].num<t) return search1(t,mid+1,j);
}

int search2(int t,int i,int j){
	int mid=(i+j)/2;
	if (j<i) return -1;
	if (b[mid].num==t&&b[mid+1].num!=t) return mid;
	if (b[mid].num>t) return search2(t,i,mid-1);
	if ((b[mid].num<t)||(b[mid].num==t&&b[mid+1].num==t)) return search2(t,mid+1,j);
}

int main()
{
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>a[i];
		b[i].num = a[i]+i;
		b[i].id = i;
	}
	b[0].num = -1;
	b[0].id=0;
	b[n+1].num=-1;
	b[n+1].id=0;
	sort(b,b+n,pd);
	for (int i=2;i<=n;i++)
	{
		pp = i-a[i];
		g = search1(pp,1,n);
		if(g!=-1)
		{
			h = search2(pp,1,n);
			while ((b[h].id>i)&&h>0) h--;
			if (h<g) continue;
			ans+=h-g+1;
		}
		
	}
	cout<<ans;
	return 0;
}
	

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'cin' was not declared in this scope
   31 |         cin>>n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:56:9: error: 'cout' was not declared in this scope
   56 |         cout<<ans;
      |         ^~~~
a.cc:56:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc: In function 'int search1(int, int, int)':
a.cc:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^
a.cc: In function 'int search2(int, int, int)':
a.cc:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
Language: C++

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

long long n, cnt, jumlah, selisih;
map<long long, long long>sum, index;
long long a[200003], b[200003];

int main(){
	cin>>n;
	for(long long i=1; i<=n; i++){
		cin>>a[i];
		b[i]=i;
	}
	for(long long i=1; i<=n; i++){
		jumlah=a[i]+b[i];
		selisih=b[i]-a[i];
		sum[jumlah]++;
		index[selisih]++;
	}
	for(long long i=1; i<=n; i++){
		jumlah=a[i]+b[i];
		selisih=b[i]-a[i];
		sum[jumlah]--;
		index[selisih]--;
		cnt=cnt+sum[selisih]+index[jumlah];
	}
	cout<<cnt<<endl;
}


Compiler output:
a.cc:5:31: error: 'std::map<long long int, long long int> index' redeclared as different kind of entity
    5 | map<long long, long long>sum, index;
      |                               ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:18:22: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
   18 |                 index[selisih]++;
      |                      ^
a.cc:24:22: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
   24 |                 index[selisih]--;
      |                      ^
a.cc:25:43: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
   25 |                 cnt=cnt+sum[selisih]+index[jumlah];
      |                                           ^
Language: C++

    //For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        
            int n;
            cin>>n;
            int ar[n+1];
            for(i=1;i<=n;++i)
            {
                cin>>ar[i];
            }
            map<int,int> mp;
            ll ans=0;
            for(int i=n;i>=1;--i)
            {
                ans=ans+mp[ar[i]+i];
                mp[i-ar[i]]++;
            }
            cout<<ans<<endl;
        
        return 0;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'i' was not declared in this scope
   34 |             for(i=1;i<=n;++i)
      |                 ^
Language: C++

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

int main(){
  int64_t N;
  cin >> N;
  vector<int64_t> A(N), B(N), C(N);
  for(int64_t i=0; i<N; i++){
    cin >> A.at(i);
    B.at(i)=A.at(i)+i;
    C.at(i)=i-A.at(i);
  }
  i-j=A.at(i)+A.at(j)
  map<int64_t, int64_t> mB, mC;
  for(int64_t i=0; i<N; i++){
    mB[B.at(i)]=mB[B.at(i)]+1;
    mC[C.at(i)]=mC[C.at(i)]+1;
  }
  int64_t Ans=0;
  for(int64_t i=0; i<N; i++){
    Ans+=mC[B.at(i)];
  }
  cout << Ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'i' was not declared in this scope
   13 |   i-j=A.at(i)+A.at(j)
      |   ^
a.cc:13:5: error: 'j' was not declared in this scope
   13 |   i-j=A.at(i)+A.at(j)
      |     ^
a.cc:16:5: error: 'mB' was not declared in this scope; did you mean 'B'?
   16 |     mB[B.at(i)]=mB[B.at(i)]+1;
      |     ^~
      |     B
a.cc:17:5: error: 'mC' was not declared in this scope; did you mean 'C'?
   17 |     mC[C.at(i)]=mC[C.at(i)]+1;
      |     ^~
      |     C
a.cc:21:10: error: 'mC' was not declared in this scope; did you mean 'C'?
   21 |     Ans+=mC[B.at(i)];
      |          ^~
      |          C
Language: C++

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

int main() {
    long long N;
    cin >> N;
    vector<long long> A(N);
    vector<long long> L(N), R(N);
    for (long long i = 0; i < N; i++) {
        cin >> A[i];
        L[i] = i + A[i];
        R[i] = i - A[i];
    }

    map<int, int> Q;
    for (long long i = 0; i < N; i++) {
        Q[L[i]] += 1;
    }
    for (long long i = 0; i < N; i++) {
        Q[R[i]] += 1;
    }
    
    long long ans = 0;
    for (auto p: Q) {
        if (p.second() == 2) {
            ans++;
        }
        
    }
    
    cout << ans << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:21: error: expression cannot be used as a function
   25 |         if (p.second() == 2) {
      |             ~~~~~~~~^~
Language: C++

#include <vector>
#include <iostream>
#include <cstdlib>
#include <utility>

int main()
{
    int N;
    std::cin >> N;
    std::vector<std::pair<int,int>> A(N);
    
    for(int i = 0; i < N; i++) {
        int a;
        std::cin >> a;
        A[i] = std::make_pair(i, a);
    }
    
    std::sort(A.begin(), A.end(), [](const std::pair<int, int>& x, const std::pair<int, int>& y){return x.second < y.second;});
    
    int count = 0;
    for(int i = 1; A[i].second < N && i < N; i++) {
        for(int j = 0; j < i; j++) {
            if(std::abs(A[i].first - A[j].first) == A[i].second + A[j].second) {
                count++;
            }
        }
    }
    std::cout << count << std::endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   18 |     std::sort(A.begin(), A.end(), [](const std::pair<int, int>& x, const std::pair<int, int>& y){return x.second < y.second;});
      |          ^~~~
      |          qsort
Language: C++

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

int main() { /* ここに書く */
  
  int N;
  cin >> N;
  
  vector<int>vec1(N);
  
  for(int i = 0; i<N ; i++){
    int h;
    cin >> h;
    vec1.at(i) = h;
  }
  
  vector<vector<int>>vec2(N,vector<int>(N));
  
  int A,B,M,n,L,s;
  int f = 0;
  n = N;
  for(int i = 0; i<N ; i++){
    A = vec1.at(i);
    for(int j = 0; j<n ; j++){
      M = N-j-1;
      B = vec1.at(M);
      
      L = A + B;
      s = M - i;
      
      if(L == s){
        
        f++;
      }
      

    }
    n--;
  }
  
  cout << f <<endl;
  

Compiler output:
a.cc: In function 'int main()':
a.cc:41:20: error: expected '}' at end of input
   41 |   cout << f <<endl;
      |                    ^
a.cc:4:12: note: to match this '{'
    4 | int main() { /* ここに書く */
      |            ^
Language: C

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    vector<ll> Fo, Se;
    ll N;
    cin>>N;
    ll A;
    rep(i, N){
        cin>>A;
        Fo.push_back(i+1+A);
        Se.push_back(i+1-A);
    }
    Fo.push_back(1000000); Se.push_back(10000000);
    ll count=0; ll fcount=0; ll scount=0; ll thisval=Fo[0];
    ll f=0, s=0;
    sort(all(Fo));
    sort(all(Se));
    while(true){
        while(Fo[f]>Se[s] && s<N) s++;
        while(Fo[f]<Se[s] && f<N) f++;
        if(f>=N || s>=N) break;
        if(Fo[f]==Se[s]){
            fcount=0; scount=0; thisval=Fo[f];
            while(Fo[f]==thisval && f<N) f++, fcount++;
            while(Se[s]==thisval && s<N) s++, scount++;
            count+=fcount*scount;
        }
    }
    cout<<count<<endl;
    return 0;
}


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

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

int main() {
  int N, , a, ans = 0;
  cin >> N;
  int arr[N];
  for(int i = 0; i < N; i++){
    cin >> a;
    if(a > 200000){
      continue;
    }
    arr[i] = a;  
    for(int j = 0; j < i; j++){
      if((i - j) == (arr[j] + arr[i])){
        ans++;
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:10: error: expected unqualified-id before ',' token
    5 |   int N, , a, ans = 0;
      |          ^
Language: Java

import java.util.*;

import jdk.internal.net.http.common.Pair;

class Main{
    static int n,pair;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        pair = n*(n-1)/2;
        int[] A = new int[n];
        int ans = 0;
        for(int i = 0;i < n;i++){
            A[i] = sc.nextInt();
        }
        
        ans = dfs(A,0,0,1,2);

        System.out.println(ans);
    }

    static int dfs(int[] a,int count,int res,int c,int d){
        if(count == pair)
            return res;
        
        return dfs(a,count+1,Math.abs(c-d) == a[c-1]+a[d-1] ? res+1 : res,d == n?c+1:c,d+1);
    }
}

Compiler output:
Main.java:3: error: package jdk.internal.net.http.common is not visible
import jdk.internal.net.http.common.Pair;
                            ^
  (package jdk.internal.net.http.common is declared in module java.net.http, which does not export it)
1 error
Language: C

#include<stdio.h>
#include <stdlib.h>

int main()
{
    int n, arr[n],count=0,sub;
    scanf("%d", &n);
    for(int i= 0; i<n; i++)
    {
        scanf("%d",&arr[i]);
    }
    for(int i=0;i<n;i++){
        int a = 1;
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0;j<n;j++)
        {
            sub = j-i;
            if(arr[i]+arr[j]==abs(int sub)){
                count = count+1;
            }
        }
    }
    printf("%d",count/2);
}


Compiler output:
main.c: In function 'main':
main.c:20:35: error: expected expression before 'int'
   20 |             if(arr[i]+arr[j]==abs(int sub)){
      |                                   ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
 int n;
  cin >> n;
  vector<ll> h(n);
  map<ll ,int> mp;
    rep(i,n) {
      cin >> h.at(i);
     if(mp.count(i+h.at(i)){
       mp.at(i+h.at(i))++;
     }
        else{
          mp[i+h.at(i)]=1;
        }
    }
  ll sum=0;
    rep(i,n){
      if(mp.count(i-h.at(i))){
       sum+=mp.at(i-h.at(i));
      }
    }
      
  cout << sum << endl;      
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: expected ')' before '{' token
   16 |      if(mp.count(i+h.at(i)){
      |        ~                   ^
      |                            )
a.cc:22:5: error: expected primary-expression before '}' token
   22 |     }
      |     ^
Language: C++

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(i,n):
        if a[j] + a[i] == abs(j-i):
            ans += 1
print(ans)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(){
  int N, A[200005], ans = 0, num, num2;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d", A + i);
  for (int i = 0; i < N; i++) {
    num = i - A[i];
    num2 = num / 2
    for (int j = 0; j < num2; j++) {
      if (num - j == A[j]) ans++;
    }
  }
  printf("%d", ans);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:10:19: error: expected ';' before 'for'
   10 |     num2 = num / 2
      |                   ^
      |                   ;
   11 |     for (int j = 0; j < num2; j++) {
      |     ~~~
Language: C++

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


int main(){
  int N;
  cin >> N;
  int A[N];
  
  for(int i = 0; i < N; i++){
	cin >> A[i];
  }
  int pair = 0;
  for(int i = 0; i < N; i++){
    for(int s = 0; s <N; s++){
      if(i == s){continue;}
       if(abs(i - s) == (A[i] + A[s])){
       pair++;
       }
    }
  cout << pair << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: Java

import java.util.*;

import jdk.internal.net.http.common.Pair;

class Main{
    static int n;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int pair = n*(n-1)/2;
        int[] A = new int[n];
        int ans = 0;
        for(int i = 0;i < n;i++){
            A[i] = sc.nextInt();
        }
        
        ans = dfs(A,0,0,1,2);

        System.out.println(ans);
    }

    static int dfs(int[] a,int count,int res,int c,int d){
        if(count == pair)
            return res;
        
        return dfs(a,count+1,Math.abs(c-d) == a[c-1]+a[d-1] ? res+1 : res,d == n?c+1:c,d+1);
    }
}

Compiler output:
Main.java:3: error: package jdk.internal.net.http.common is not visible
import jdk.internal.net.http.common.Pair;
                            ^
  (package jdk.internal.net.http.common is declared in module java.net.http, which does not export it)
Main.java:23: error: cannot find symbol
        if(count == pair)
                    ^
  symbol:   variable pair
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int binary_search(vector<ll> a,ll key) {
    ll left = 0, right =a.size() - 1; // 配列 a の左端と右端
    while (right >= left) {
        ll mid = left + (right - left) / 2; // 区間の真ん中
        if (a.at(mid) == key) return true;
        else if (a.at(mid) > key) right = mid - 1;
        else if (a.at(mid) < key) left = mid + 1;
    }
    return -1;
}
int main() {
  ll N,ans=0;
  cin>>N;
  vector<ll> wa(N);
  vector<ll> sa(N);
  for(ll i=0;i<N;i++){
    ll a;
    cin>>a;
    wa.at(i)=a+i+1;
    sa.at(i)=a-i-1;
  }
  sort(wa.begin(),wa.end());
  for(ll i=0;i<N;i++){
    if(binary_search(wa,sa.at(i))){ans++;};
  }
  cout<<ans/2+a%2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:15: error: 'a' was not declared in this scope; did you mean 'sa'?
   29 |   cout<<ans/2+a%2<<endl;
      |               ^
      |               sa