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

#include <bits/stdc++.h>
using namespace std;
 
#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif
 
void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}
 
const int N = 2e5+34;
 
int a[N];
int h[N];
 
void solve() {
    int n; scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", h+i);
        a[i] = i+1-h[i];
    }
    sort(a, a+n);
    long long ans = 0;
    for (int i = 0; i < n-1; ++i) {
        int x = i+1+h[i];
        const auto p = equal_range(a, a+n, x);
        ans += p.second-p.first;
    }
    printf("%lld", ans);
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int main(void)
    int n,i,j,ans=0,x;
    cin>>n;
    vector<int> vec(n,0);
    for(i=0;i<n;i++){
        cin>>x;
        if(i-x>=0)ans+=vec[i-x];
        if(i+x<n-1)vec[i+x]++;
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc:5:5: error: expected initializer before 'int'
    5 |     int n,i,j,ans=0,x;
      |     ^~~
a.cc:6:5: error: 'cin' does not name a type
    6 |     cin>>n;
      |     ^~~
a.cc:7:21: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |     vector<int> vec(n,0);
      |                     ^
      |                     yn
a.cc:8:5: error: expected unqualified-id before 'for'
    8 |     for(i=0;i<n;i++){
      |     ^~~
a.cc:8:13: error: 'i' does not name a type
    8 |     for(i=0;i<n;i++){
      |             ^
a.cc:8:17: error: 'i' does not name a type
    8 |     for(i=0;i<n;i++){
      |                 ^
a.cc:13:5: error: 'cout' does not name a type
   13 |     cout<<ans<<endl;
      |     ^~~~
a.cc:14:1: error: expected declaration before '}' token
   14 | }
      | ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_set>
namespace { using std::cin, std::cout, std::endl, std::string, std::vector; }

int main()
{
	int N;
	cin >> N;
	vector<int> A(N);
	std::unordered_set<int> set;
	int count = 0;
	for (auto& i : A)
		cin >> i;
	for (int i = 0; i < N; ++i)
		set.emplace(A[i] + i);
	for (int i = 0; i < N; ++i)
		if (set.contains(i - A[i]))
			count++;
	cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: 'class std::unordered_set<int>' has no member named 'contains'
   20 |                 if (set.contains(i - A[i]))
      |                         ^~~~~~~~
Language: C

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

int main()
{
    vector <unsigned int> height;
   unsigned int n, i,j, number = 0,min=0,max=0;
   scanf("%u", &n);

    for(i = 0; i < n; i++)
    {
        scanf("%u", &number);
        if(number>max)max=number;
        if(number<min||i==0)min=number;
        height.push_back(number);

    }
   // printf("%u\n",min);
   number=0;

    for(i = 0; i < n-1; i++)
    {
        j=(2*min>height[i])?i+2*min:i+height[i];

        for( ; j < n&&(j - i)<=2*max; j++)
        {
            if((j - i) == height[i] + height[j])
            {
                number++;
            }
        }
    }

    printf("%u\n", number);
    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 "bits/stdc++.h"
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << endl

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int n;
  cin>>n;
  int a;
  int ans=0;
  map<long long,int>m;
  
  for(int i=1;i<=n;i++){
    cin>>a;

    if(m.count(i-a)){
      ans+=m[i-a];
    }
    m[a[i]+i];
  }

  cout<<ans<<endl;

  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:8: error: invalid types 'int[int]' for array subscript
   21 |     m[a[i]+i];
      |        ^
Language: C

#include <stdio.h>
#include <stdlib.h>
unsigned int height[200005];
int main()
{
   unsigned int n, i,j, number = 0,min=0,max=0;
   scanf("%u", &n);

    for(i = 0; i < n; i++)
    {
        scanf("%u", &height[i]);
        if(height[i]>max)max=height[i];
        if(height[i]<min||i=0)min=height[i];
    }

    for(i = 0; i < n-1; i++)
    {

        for( j = i + 1; j < n&&abs(j - i)<=2*max&&abs(j - i)>=2*min; j++)
        {
            if(abs(j - i) == height[i] + height[j])
            {
                number++;
            }
        }
    }

    printf("%u\n", number);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:13:28: error: lvalue required as left operand of assignment
   13 |         if(height[i]<min||i=0)min=height[i];
      |                            ^
Language: C++

#include <iostream>
#include <map>


using namespace std;
int main(){
	int N;
  	int A[200001];
  cin >> N;
  map<int,int> dif;
  for(int i=1; i<=N;i++){
   cin >> A[i]; 
    if(dif.find(A[i]+i)==dif.end())
      dif[A[i]+i] = 0;
    dif[A[i]+i]++;
  }
	long count = 0;
  	for(int j=1;j<=N;j++){
      if(dif.find(j-A[J])!=dif.end())
		count+=dif[j-A[j]];
    }
  
  cout << count <<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: error: 'J' was not declared in this scope
   19 |       if(dif.find(j-A[J])!=dif.end())
      |                       ^
Language: Java

import java.io.*;

import java.math.BigInteger;
import java.util.*;

import java.util.ArrayList;

import java.util.Scanner;


public class main {

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static final int mod = 1000000007;

    public static int gcd(int a, int b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();

       int a[]=new int[n];
       for(int j=0;j<n;j++)
           a[j]=sc.nextInt();

       HashMap<Integer,Integer>hm=new HashMap<>();
        HashMap<Integer,Integer>hm1=new HashMap<>();
        int b[]=new int[n];
        int c[]=new int[n];
        for(int j=0;j<n;j++)
        {
            b[j]=(j+1)+a[j];
            c[j]=(j+1)-a[j];
        }
        for(int j=0;j<n;j++)
        {
            hm.put(b[j],hm.getOrDefault(b[j],0)+1);
        }
        long res=0;

        for(int j=0;j<n;j++)
        {
            if(hm.get(c[j])!=null)
                res+=hm.get(c[j]);
        }

        System.out.println(res);


    }
}









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

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

#define rep3(i, s, n ,a) for (int i = (s); i < (int)(n); i+=a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

//#define MAX 1000200

int main(){
    int n;
    cin >> n;
    vector<int> a;
    rep(i, n){
        int height;
        cin >> height;
        a.push_back(height);
    }
    long cnt=0;
    map<int, int> l, r;
    //int minim=INT_MAX, maxim=0;
    // rep(i, MAX+1){
    //     l[i] = 0;
    //     r[i] = 0;
    // }
    //cout << "OK" << endl;
    rep(i, n){
        l[a[i]+i+1]++;
        if(i+1-a[i]>=0){
            r[i+1-a[i]]++;
        }
        // cout << l[a[i]+i+1] << endl;
    }
    map<int, int>::iterator L;
    for(L=l.begin(); L != l.end(); L++){
        int item = (*L).first;
        cout << item << " : " << l[item] << 
        // if(r.find(item)!=r.end()||item==(*r.end()).first){
        //     cnt +=  l[item] * r[item];
        // }
        cnt +=  (long)l[item] * (long)r[item];
        // cout << cnt << endl;
    }
    cout << cnt << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:13: error: no match for 'operator+=' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'long int')
   41 |         cnt +=  (long)l[item] * (long)r[item];
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() {
    ll n,ans=0;
    cin >> n;
    vector<vector<int>> l(n), r(n);
    rep(i, n){
        int a;
        cin >> a;
        l.at(a + i).push_back(i);
        if(j-a>0){
            r.at(j - a).push_back(i);
        }
    }
    rep(i,n){
        ans += min(l.at(i).size(), r.at(i).size());
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: 'j' was not declared in this scope
   15 |         if(j-a>0){
      |            ^
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() {
    ll n,ans=0;
    cin >> n;
    voctor<int, vector<int>> l(n), r(n);
    rep(i, n){
        int a;
        cin >> a;
        l.at(a + i).push_back(i);
        if(j-a>0){
            r.at(j - a).push_back(i);
        }
    }
    rep(i,n){
        ans += min(l.at(i).size(), r.at(i).size());
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'voctor' was not declared in this scope
   10 |     voctor<int, vector<int>> l(n), r(n);
      |     ^~~~~~
a.cc:10:12: error: expected primary-expression before 'int'
   10 |     voctor<int, vector<int>> l(n), r(n);
      |            ^~~
a.cc:14:9: error: 'l' was not declared in this scope
   14 |         l.at(a + i).push_back(i);
      |         ^
a.cc:15:12: error: 'j' was not declared in this scope
   15 |         if(j-a>0){
      |            ^
a.cc:16:13: error: 'r' was not declared in this scope
   16 |             r.at(j - a).push_back(i);
      |             ^
a.cc:20:20: error: 'l' was not declared in this scope
   20 |         ans += min(l.at(i).size(), r.at(i).size());
      |                    ^
a.cc:20:36: error: 'r' was not declared in this scope
   20 |         ans += min(l.at(i).size(), r.at(i).size());
      |                                    ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long int64;
int P[200000];
int M[200000];

int main() {
	memset(P, 0, sizeof(P));
	memset(P, 0, sizeof(M));
	int N;
	cin >> N;
	int tmp;
	int64 ans = 0;
	for (int i = 0; i < N; ++i) {
		cin >> tmp;
		if (i+tmp < 200000) {
			++P[i+tmp];
			if (i-tmp > 0) ++M[i-tmp];
		}
	}
	for (int i = 1; i < N; ++i) {
		ans += (int64)P[i] * M[i];
	}
	cout << ans << "\n";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'memset' was not declared in this scope
   11 |         memset(P, 0, sizeof(P));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <map>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C

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

template<typename T>
void read(T &n){
    n = 0;
    T f = 1;
    char c = getchar();
    while(!isdigit(c) && c != '-') c = getchar();
    if(c == '-') f = -1, c = getchar();
    while(isdigit(c)) n = n*10+c-'0', c = getchar();
    n *= f;
}
template<typename T>
void write(T n){
    if(n < 0) putchar('-'), n = -n;
    if(n > 9) write(n/10);
    putchar(n%10+'0');
}

int n;
ll a[MAX];
map<ll, ll> mp;

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++){
        read(a[i]);
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += mp[a[i]-i];
        mp[-a[i]-i]++;
    }
    cout << ans << 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>
        #include <iostream>
        #include <string.h>
        #include <map>
        using namespace std;
         
        int main()
        {
            int n = 0, b, c = 0;
            map<int, int> mp;
            cin >> n;
            for (int i = 1; i <= n; i++)
            {
                cin >> b;
                if (i - b > 0)
                {
                    c += mp[i - b];
                }
              
                    mp[i + b]++;
                
            }
            cout << cnt;
            return 0;
        }

Compiler output:
a.cc: In function 'int main()':
a.cc:23:21: error: 'cnt' was not declared in this scope; did you mean 'int'?
   23 |             cout << cnt;
      |                     ^~~
      |                     int
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];
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<n;j++)
    {
      if(fabs(i-j)==(a[i]+a[j]))
        cnt++;
    }
  }
  cout<<cnt<<endl;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   14 |         cnt++;
      |         ^~~
      |         int
a.cc:17:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   17 |   cout<<cnt<<endl;
      |         ^~~
      |         int
Language: C++

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 ll long long
#define ff first
#define ss second
#define pb push_back
#define w(t) int t;cin>>t; while(t--)
using namespace std;

//a5 – b5 = (a – b)(a4 + a3b + a2b2 + ab3 + b4)


int main(){
    ll n;
    cin>>n;
    ll arr[n+1];
    for(ll i=1; i<=n; i++) cin>>arr[i];
    ll left[n+1], right[n+1];
    ll ans = 0;
    map<ll, ll> ml, mr;
    for(ll i=1; i<=n; i++){
        left[i] = arr[i]+i;
        right[i] = i-arr[i];
        ml[left[i]]++;
        mr[right[i]]++;
    }
    for(ll i=1; i<=n; i++){
        if(mr[left[i]]>0){
            ans += mr[left[i]];
            
        }
    }
    cout<<ans;
}

Compiler output:
a.cc:2:64: error: stray '#' in program
    2 | 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>
      |                                                                ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 32
      | ^~
a.cc: In function 'int main()':
a.cc:15:5: error: 'cin' was not declared in this scope
   15 |     cin>>n;
      |     ^~~
a.cc:20:5: error: 'map' was not declared in this scope
   20 |     map<ll, ll> ml, mr;
      |     ^~~
a.cc:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
a.cc:20:9: note: in expansion of macro 'll'
   20 |     map<ll, ll> ml, mr;
      |         ^~
a.cc:24:9: error: 'ml' was not declared in this scope; did you mean 'll'?
   24 |         ml[left[i]]++;
      |         ^~
      |         ll
a.cc:25:9: error: 'mr' was not declared in this scope
   25 |         mr[right[i]]++;
      |         ^~
a.cc:28:12: error: 'mr' was not declared in this scope
   28 |         if(mr[left[i]]>0){
      |            ^~
a.cc:33:5: error: 'cout' was not declared in this scope
   33 |     cout<<ans;
      |     ^~~~
Language: C++

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

#include <graph.h>

// std::vector<int> count(N, 0);


template <typename T>
T read_cin()
{
	T input;
	std::cin >> input;
	return input;
}

int main(void)
try
{
	const int N = read_cin<int>();
	std::vector<int> A(N);
	for (int i = 0; i < N; i++)
	{
		A[i] = read_cin<int>();
	}

	unsigned int pair_count = 0;
	for (unsigned int i = 0; i < N; i++)
	{
		for (unsigned int j = i + 1, diff = 1; j < N; j++, diff++)
		{
			const unsigned int A_sum = A[i] + A[j];
			if (diff == A_sum)
			{
				++pair_count;
			}
		}
	}
	
	std::cout << pair_count << std::endl;
}
catch (const std::exception& e)
{
	std::cout << e.what();
	return EXIT_FAILURE;
}
catch (...)
{
	return EXIT_FAILURE;
}

Compiler output:
a.cc:5:10: fatal error: graph.h: No such file or directory
    5 | #include <graph.h>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <list>
#include <map>

class Pair {
public:
    std::list<long> L;
    std::list<long> R;
};

int main(void) {
    long n, N, A;
    long A;
    long X, L, R, counter = 0;
    std::map<int, Pair> LR;
    Pair pair;
    
    std::cin >> N;
    
    for(n = 1; n <= N; n++) {
        std::cin >> A;
        L = n + A;
        LR[L].L.push_back(n);
        
        R = n - A;
        
        if(R > 0) {
            LR[R].R.push_back(n);
        }
        
    }
    
    for(auto itr = LR.begin(); itr != LR.end(); itr++) {
        pair = itr -> second;
        counter += pair.L.size() * pair.R.size();
    }
    
    std::cout << counter << std::endl;
    
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: redeclaration of 'long int A'
   13 |     long A;
      |          ^
a.cc:12:16: note: 'long int A' previously declared here
   12 |     long n, N, A;
      |                ^
Language: C

#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
int a[MAXN];
unordered_map<int, int>cnt;
int main(){
    int n; scanf("%d", &n);
    long long ans = 0;
    for (int i = 1; i <= n; i++){
        scanf("%d", a + i);
        ans += cnt[a[i] - i];
        cnt[-i - a[i]]++;
    }
    printf("%lld\n", ans);
    return 0;
}

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

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

int main() {
  int n; cin >> n;
  vector<ll> sum(sz), diff(sz);
  rep(i,n) {
    int a; cin >> a;
    if (i + a < sz) sum[i + a]++;
    if (i - a > 0) diff[i - a]++;
  }
  ll ans = 0;
  rep(i,sz) ans += sum[i] * diff[i];
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'll'
    3 | using ll == long long;
      |       ^~
a.cc: In function 'int main()':
a.cc:9:10: error: 'll' was not declared in this scope
    9 |   vector<ll> sum(sz), diff(sz);
      |          ^~
a.cc:9:12: error: template argument 1 is invalid
    9 |   vector<ll> sum(sz), diff(sz);
      |            ^
a.cc:9:12: error: template argument 2 is invalid
a.cc:12:24: error: invalid types 'int[int]' for array subscript
   12 |     if (i + a < sz) sum[i + a]++;
      |                        ^
a.cc:13:24: error: invalid types 'int[int]' for array subscript
   13 |     if (i - a > 0) diff[i - a]++;
      |                        ^
a.cc:15:5: error: expected ';' before 'ans'
   15 |   ll ans = 0;
      |     ^~~~
      |     ;
a.cc:16:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   rep(i,sz) ans += sum[i] * diff[i];
      |             ^~~
      |             abs
a.cc:16:23: error: invalid types 'int[int]' for array subscript
   16 |   rep(i,sz) ans += sum[i] * diff[i];
      |                       ^
a.cc:16:33: error: invalid types 'int[int]' for array subscript
   16 |   rep(i,sz) ans += sum[i] * diff[i];
      |                                 ^
a.cc:17:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: Java

public class Main {
 final static int maxn=(int)2e5+10;
 static int l[]=new int [maxn];static int r[]=new int [maxn];
 static int slove(int len,int num)
 {
	 int left=1;int right=len;
	 while(left<right)
	 {
		 int mid=(left+right)/2;
		 if(r[mid]>=num)right=mid;
		 else
			 left=mid+1;
	 }
	 return left;
 }
 public static void main(String args[])
 {
	 Scanner input=new Scanner(System.in);
	int n=input.nextInt();
	for(int i=1;i<=n;i++)
	{
		int x=input.nextInt();
		l[i]=i-x;r[i]=i+x;
	}
	int ans=0;
   Arrays.sort(l,1,1+n);Arrays.sort(r,1,n+1);
   for(int i=1;i<=n;i++)
   {
	   int index=slove(n,l[i]);
	   if(r[index]==l[i])
	   {
		   for(int j=index;j<=n;j++)
		   {
			   if(r[j]==l[i])ans++;
			   else
				   break;
		   }
	   }
   }
   System.out.println(ans);;
 }
} 


Compiler output:
Main.java:18: error: cannot find symbol
	 Scanner input=new Scanner(System.in);
	 ^
  symbol:   class Scanner
  location: class Main
Main.java:18: error: cannot find symbol
	 Scanner input=new Scanner(System.in);
	                   ^
  symbol:   class Scanner
  location: class Main
Main.java:26: error: cannot find symbol
   Arrays.sort(l,1,1+n);Arrays.sort(r,1,n+1);
   ^
  symbol:   variable Arrays
  location: class Main
Main.java:26: error: cannot find symbol
   Arrays.sort(l,1,1+n);Arrays.sort(r,1,n+1);
                        ^
  symbol:   variable Arrays
  location: class Main
4 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<lint> a(n), b(n);
    for(int i=0;i<n;++i){
        cin>>a[i];
        b[i]=i+a[i];
    }
    map<long long,long long> cnt;
    long long ret=0;
    cnt[b[0]]=1;
    for(int i=1;i<n;++i){
        ret+=cnt[i-a[i]];
        cnt[b[i]]++;
    }
    cout<<ret<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: 'lint' was not declared in this scope; did you mean 'uint'?
    6 |     vector<lint> a(n), b(n);
      |            ^~~~
      |            uint
a.cc:6:16: error: template argument 1 is invalid
    6 |     vector<lint> a(n), b(n);
      |                ^
a.cc:6:16: error: template argument 2 is invalid
a.cc:8:15: error: invalid types 'int[int]' for array subscript
    8 |         cin>>a[i];
      |               ^
a.cc:9:10: error: invalid types 'int[int]' for array subscript
    9 |         b[i]=i+a[i];
      |          ^
a.cc:9:17: error: invalid types 'int[int]' for array subscript
    9 |         b[i]=i+a[i];
      |                 ^
a.cc:13:10: error: invalid types 'int[int]' for array subscript
   13 |     cnt[b[0]]=1;
      |          ^
a.cc:15:21: error: invalid types 'int[int]' for array subscript
   15 |         ret+=cnt[i-a[i]];
      |                     ^
a.cc:16:14: error: invalid types 'int[int]' for array subscript
   16 |         cnt[b[i]]++;
      |              ^
Language: Java


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

public class AssignE {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

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

        System.out.println(solve2(N, A));
    }

    /**
     * https://www.hamayanhamayan.com/entry/2020/05/03/224417
     * @param N
     * @param A
     * @return
     */
    private static long solve2(int N, int[] A) {
        long count = 0;
        HashMap<Integer, Integer> map = new HashMap<>();

        // i+A[i] と i-A[i]を同時に更新・参照することで
        // i < j について i-A[i] == j+A[j] がチェックできる
        // (i > j のときは iがまだ未評価なので0となる
        for (int i=0; i<N; i++) {
            count += map.getOrDefault(i-A[i], 0);

            int val = map.getOrDefault(i+A[i], 0);
            map.put(i+A[i], val+1);
        }

        return count;
    }
}

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


#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a

ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;




int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    std::vector<int> v((n+2));
    for (int i = 0; i < n; i++) {
        cin>>v[i];
    }
    set<int>set1;
    map<int, int>mp1,mp2;
    for (int i = 0; i < n; i++) {
        int diff = i-v[i];
        //dump(diff);
        set1.insert(diff);
        if(diff != i)
             mp1[diff]++;
    }
    ll int cnt = 0;
    for (int i = 0; i < n; i++) {
        int sum = (i+v[i]);
        //dump(sum);
        if(set1.count(sum)){
            mp2[sum]++;
            //cnt++;
        }
    }
    for(auto it : mp1){
        cnt +=((ll)mp1.second * mp2[mp1.first]);
    }
    cout<<cnt<<"\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:24: error: 'class std::map<int, int>' has no member named 'second'
   52 |         cnt +=((ll)mp1.second * mp2[mp1.first]);
      |                        ^~~~~~
a.cc:52:41: error: 'class std::map<int, int>' has no member named 'first'
   52 |         cnt +=((ll)mp1.second * mp2[mp1.first]);
      |                                         ^~~~~
Language: C++

#include <cstdio>
#include <map>
#define maxn 200010
using namespace std;
int a[maxn],n;
LL ans;
map<int,int> mp;
int main(){
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&a[i]);
	for(i=1;i<=n;i++)
		if(i-a[i]>0)mp[i-a[i]]++;
	for(i=1;i<=n;i++)
		if(mp[a[i]+i])ans+=mp[a[i]+i];
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc:6:1: error: 'LL' does not name a type; did you mean 'NULL'?
    6 | LL ans;
      | ^~
      | NULL
a.cc: In function 'int main()':
a.cc:15:31: error: 'ans' was not declared in this scope
   15 |                 if(mp[a[i]+i])ans+=mp[a[i]+i];
      |                               ^~~
a.cc:16:25: error: 'ans' was not declared in this scope
   16 |         printf("%lld\n",ans);
      |                         ^~~
Language: C++

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  int n;
  cin >> n;
  ll ans = 0;
  map<ll, ll> mp;
  rep(i, n){
    ll a;
    cin >> a;
    mp[a+i]++;
    mp[a-i]++;
  }
  for(auto m: mp){
    ans += (m*(m-1))/2;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:25:3: error: 'map' was not declared in this scope
   25 |   map<ll, ll> mp;
      |   ^~~
a.cc:13:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
   12 | #include <iterator>
  +++ |+#include <map>
   13 | 
a.cc:25:9: error: expected primary-expression before ',' token
   25 |   map<ll, ll> mp;
      |         ^
a.cc:25:13: error: expected primary-expression before '>' token
   25 |   map<ll, ll> mp;
      |             ^
a.cc:25:15: error: 'mp' was not declared in this scope
   25 |   map<ll, ll> mp;
      |               ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int

struct Union{
  vector<ll> par;
  Union(ll a){
  par=vector<ll>(a,-1);
  }
  ll find(ll a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(ll a,ll b){
    return (find(a)==find(b));
  }
  ll size(ll a){
    return -par[find(a)];
  }
  void unite(ll a,ll b){
    ll c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
ll Nagaemon1;
void swap(ll i,ll j){
  Nagaemon1=i;
  i=j;
  j=Nagaemon1;
}
int main(){
  ll n;
  cin >> n,l,r;
  vector<ll> a(n);
  vector<ll> w(1000000001),e(1000000001);
  rep(i,n){
    cin >> a[i];
    l=i-a[i];
    r=i+a[i];
    w[l]++;
    e[r]++;
  }
  ll ans=0;
  rep(i,1000000001){
    ans+=w[i]*e[i];
  }
  cout << ans;
}

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

#include<bits/stdc++.h>
using namespace std;
#define Maxn 200010
#define Maxc 400010

int n, x, Res;
vector<int > Up;
int Count[MaxC];

int main()
{
	scanf("%d", &n);
	for (int i=1; i<=n; i++)
	{
		scanf("%d", &x);
		if (x>Maxn) continue;
		if (i>x) Up.push_back(i-x);
		Count[i+x]++;
	}
	for (auto p: Up) Res+=Count[p];
	printf("%d\n", Res);
}

Compiler output:
a.cc:8:11: error: 'MaxC' was not declared in this scope; did you mean 'Maxc'?
    8 | int Count[MaxC];
      |           ^~~~
      |           Maxc
a.cc: In function 'int main()':
a.cc:18:17: error: 'Count' was not declared in this scope
   18 |                 Count[i+x]++;
      |                 ^~~~~
a.cc:20:31: error: 'Count' was not declared in this scope
   20 |         for (auto p: Up) Res+=Count[p];
      |                               ^~~~~
Language: C++

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

int main(){
	unordered_map<long long,int> ma;
  	vector<long long> A;
  	long long N;
  	cin >> N;
  	for (int i = 0; i < N; ++i){
    	long long tmp;
      	cin >> tmp;
      	A.push_bacK(tmp);
    }
  	long long ans = 0;
  	for (int i = 0; i < N; ++i){
    	ans += ma[i - A[i]];
      	++ma[A[i] + i];
    }
  	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'class std::vector<long long int>' has no member named 'push_bacK'; did you mean 'push_back'?
   12 |         A.push_bacK(tmp);
      |           ^~~~~~~~~
      |           push_back
Language: C

# include <bits/stdc++.h>
# define int      long long
# pragma GCC optimize "-O3"

using namespace std; 
map <int, int> mp;
void solve(){
    int n = 0, m = 0;
    cin >> n;
    vector <int> v(n);
    
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
        m += mp[ i - v[i] ];
        mp[ i + v[i] ]++;
    }
    cout << m;
}
int32_t main(){
    //speed;

    int T = 1;
    //cin >> T;
    while( T-- ){
         solve();
         cout<<'\n';
    }
    //time;
}
 

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

# include <bits/stdc++.h>
# define int      long long
# define all(vc)   vc.begin(),vc.end()
# define all2(vc)  vc.rbegin(),vc.rend()
# define pb        push_back
# define vec       vector
# define fi        first 
# pragma GCC optimize "-O3"
# define se        second
# define speed     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# define time      cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std; 
map <int, int> mp;
void solve(){
    int n = 0, m = 0;
    cin >> n;
    vec <int> v(n);
    
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
        m += mp[ i - v[i] ];
        mp[ i + v[i] ]++;
    }
    cout << m;
}
int32_t main(){
    speed;

    int T = 1;
    //cin >> T;
    while( T-- ){
         solve();
         cout<<'\n';
    }
    //time;
}
 

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

# include <bits/stdc++.h>
# define int      long long
# define all(vc)   vc.begin(),vc.end()
# define all2(vc)  vc.rbegin(),vc.rend()
# define pb        push_back
# define vec       vector
# define fi        first 
# define se        second
# define speed     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# define time      cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std; 
map <int, int> mp;
void solve(){
    int n = 0, m = 0;
    cin >> n;
    vec <int> v(n);
    
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
        m += mp[ i - v[i] ];
        mp[ i + v[i] ]++;
    }
    cout << m;
}
int32_t main(){
    speed;

    int T = 1;
    //cin >> T;
    while( T-- ){
         solve();
         cout<<'\n';
    }
    time;
}
 

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

# include <bits/stdc++.h>
# define int      long long
# define all(vc)   vc.begin(),vc.end()
# define all2(vc)  vc.rbegin(),vc.rend()
# define pb        push_back
# define vec       vector
# define fi        first 
# define se        second
# define speed     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# define time      cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std; 
void solve(){
    int n = 0, m = 0;
    cin >> n;
    vec <int> v(n + 1);
    map <int, int> mp;
    for (int i = 1; i <= n; ++i)
    {
        cin >> v[i];
        m += mp[ i - v[i] ];
        mp[ i + v[i] ]++;
    }
    cout << m;
}
int32_t main(){
    speed;

    int T = 1;
    //cin >> T;
    while( T-- ){
         solve();
         cout<<'\n';
    }
    time;
}
 

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

/*
h1, h2, h3, ....., hn-1, hn

1, 2, 3, ......, n-1, n

hi + hj = j - i; j>i

hi + i = j - hj

arr1 = {h1+1, h2+2, h3+3, ....., hn+n}
arr2 = {1-h1, 2-h2, 3-h3, ....., n-hn}

arrf[][0] = {{i, hi+i}, {j, hj+j}, {}}
arrf[][1] = {{i, i-hi}, {j, j-hj}, {}}

*/

#include <bits/stdc++.h>

#define pb push_back

using namespace std;

typedef long long ll;

vector<int> arrf[2][500005];
ll revmp[500005];

int main(){
	int n;
	vector<ll> a;
	map<ll, int> mp;
	cin>>n;
	a.assign(n+1, 0);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int cnt = 0;
	for(int i=0;i<n;i++){
		ll sum = a[i]+i+1;
		ll diff = i+1-a[i];
		if(mp.count(sum) == 0){
			revmp[cnt] = sum;
			mp[sum] = cnt++;
		}
		arrf[0][mp[sum]].pb(i+1);
		if(diff >= 0){
			if(mp.count(diff) == 0){
				revmp[cnt] = diff;
				mp[diff] = cnt++;
			}
			arrf[1][mp[diff]].pb(i+1);
		}
	}
	for(int i=0;i<cnt;i++){
		sort(arrf[0][i].begin(), arrf[0][i].end());
		sort(arrf[1][i].begin(), arrf[1][i].end());
	}
	/*for(int i=0;i<cnt;i++){
		cout<<i<<" "<<revmp[i]<<":\n"<<"==sum==\n";
		for(int j=0;j<arrf[0][i].size();j++){
			cout<<arrf[0][i][j]<<" ";
		}
		cout<<"\n==diff==\n";
		for(int j=0;j<arrf[1][i].size();j++){
			cout<<arrf[1][i][j]<<" ";
		}
		cout<<"\n";
	}*/
	ull ans = 0;
	for(int i=0;i<cnt;i++){
		for(int j=0;j<arrf[0][i].size();j++){
			int idx = upper_bound(arrf[1][i].begin(), arrf[1][i].end(), arrf[0][i][j])-arrf[1][i].begin();
			ull tmp = arrf[1][i].size()-idx;
			ans += tmp;
		}	
	}
	cout<<ans<<"\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:9: error: 'ull' was not declared in this scope; did you mean 'll'?
   70 |         ull ans = 0;
      |         ^~~
      |         ll
a.cc:74:28: error: expected ';' before 'tmp'
   74 |                         ull tmp = arrf[1][i].size()-idx;
      |                            ^~~~
      |                            ;
a.cc:75:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   75 |                         ans += tmp;
      |                         ^~~
      |                         abs
a.cc:75:32: error: 'tmp' was not declared in this scope; did you mean 'mp'?
   75 |                         ans += tmp;
      |                                ^~~
      |                                mp
a.cc:78:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   78 |         cout<<ans<<"\n";
      |               ^~~
      |               abs
Language: C++

#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pair <int,int>> >
#define vvb vector <vector <bool> >
#define fr(i,n) for (int i = 0; i < (n); i++)
#define frbig(i,n) for (lli i = 0; i < (n); i++)
#define fra(i,a,n) for (lli i = a; i < (n); i++)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
const lli MOD = 1e9 + 7;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    read(t);
    vi a(n);
    map <int,int> s1,s2;
    lli ans=0;
    fr(i,n){ 
        cin >> a[i];
        s2[i]=i-a[i];
        ans+=s1.count(s2[i]);
        s1[i]=a[i]+i;
    } 
    cout << ans;    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:10: error: 'n' was not declared in this scope
   39 |     vi a(n);
      |          ^
Language: C

# include <bits/stdc++.h>
# define int      long long
# define all(vc)   vc.begin(),vc.end()
# define all2(vc)  vc.rbegin(),vc.rend()
# define pb        push_back
# define vec       vector
# define fi        first 
# define se        second
# define speed     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# define time      cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std; 
void solve(){
    int n = 0, m = 0;
    cin >> n;
    vec <int> v(n + 1);
    for (int i = 1; i <= n; ++i)
    {
        cin >> v[i];
    }
    for (int i = 1; i <= n; ++i)
    {
        for (int j = i + 1; j <= n; ++j)
        {
            if( v[i] + i == j - v[j] ) m++;
        }
    }
    cout << m;
}
int32_t main(){
    speed;

    int T = 1;
    //cin >> T;
    while( T-- ){
         solve();
         cout<<'\n';
    }
    time;
}
 

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

#include<bits/stc++.h>

using namepsace std;
int main()
 {
 int n;
 cin>>n;
 vector<int> v(n);
 for(int i= 0;i<n;i++)
  cin>>v[i];
 int count = 0;
 for(int i= 0 ;i<n-1;i++)
  {
    for(int j = i+1;j<n;j++)
     {
       if(j - i == v[j] + v[i])
        count++;
     }
  }
 cout<<count; 
 return 0;
 }
 

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

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long ans = 0;
    HashMap<Long, Long> map = new HashMap<Long, Long>();
    long a = sc.nextLong();
    map.put(a, 1);
    for(int i = 1; i < n; i++) {
      long a = sc.nextLong();
      if(map.containsKey(i - a)) ans += map.get(i - a);
      if(map.containsKey(i + a)) {
        map.put(i + a, map.get(i + a) + 1);
      } else {
        map.put(i + a, 1);
      }
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:10: error: incompatible types: int cannot be converted to Long
    map.put(a, 1);
               ^
Main.java:12: error: variable a is already defined in method main(String[])
      long a = sc.nextLong();
           ^
Main.java:17: error: incompatible types: int cannot be converted to Long
        map.put(i + a, 1);
                       ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
3 errors
Language: C++


#include <iostream>
#include <unordered_set>
using namespace std;
#include <unordered_map>
#include <vector>
#include <math.h> 
#include <stdio.h>
int main(){
    int x ;
    cin>>x;
    
    vector<int> v;
    while(x--){
        int a;
        cin>>a;
        v.push_back(a);
        
    }
    unordered_map<int> map;
    
    for(int j=0;j<v.size();j++){
        map[j-v[j]]++;
    }
    int ans=0;
    for(int i=0;i<v.size();i++){
        if(map.find(i+v[i])!=map.end()){
            ans=ans+map[i+v[i]];
        }
    }
   
    cout<<ans<<endl;
    
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: wrong number of template arguments (1, should be at least 2)
   20 |     unordered_map<int> map;
      |                      ^
In file included from /usr/include/c++/14/unordered_map:41,
                 from a.cc:5:
/usr/include/c++/14/bits/unordered_map.h:109:11: note: provided for 'template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> class std::unordered_map'
  109 |     class unordered_map
      |           ^~~~~~~~~~~~~
a.cc:23:12: error: invalid types 'int[int]' for array subscript
   23 |         map[j-v[j]]++;
      |            ^
a.cc:27:16: error: request for member 'find' in 'map', which is of non-class type 'int'
   27 |         if(map.find(i+v[i])!=map.end()){
      |                ^~~~
a.cc:27:34: error: request for member 'end' in 'map', which is of non-class type 'int'
   27 |         if(map.find(i+v[i])!=map.end()){
      |                                  ^~~
a.cc:28:24: error: invalid types 'int[int]' for array subscript
   28 |             ans=ans+map[i+v[i]];
      |                        ^
Language: C

#include "bits/stdc++.h"

using namespace std;
using ll = long long int;

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

    vector<ll> A(n);
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }

    unordered_map<ll, int> count;
    for (int i = 0; i < n; i++)
    {
        count[i - A[i]]++;
    }

    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans += count[A[i] + i];
    }

    cout << ans << endl;
}

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>
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
    int a;
    cin >> a;
    int l, i = 0, b[200001], c[200001], d[200001], cnt = 0;
    while (cin >> l)
    {a
        b[i] = l;
        i++;
    }
    for (int i = 0; i < a; i++)
    {
        c[i] = i + b[i];
        d[i] = i - b[i];
    }

    for (int k = 0; k < a; k++)
    {
        for (int j = k; j < a; j++)
        {
            if (c[k] == d[j])
            {
                cnt += 1;
            }
        }
    }

    cout << cnt;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: expected ';' before 'b'
   13 |     {a
      |       ^
      |       ;
   14 |         b[i] = l;
      |         ~
Language: C++

//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n; cin >> n;
    vector<int> a(n+1);
    map<ll, int> freq;
    rep(i, n)  cin >> a[i+1];

    for(int i = 1; i <= n; ++i) {
        ll tmp = i - a[i];
        if(tmp > 0) {
            freq[tmp]++;
        }
    }

    llans = 0;
    for(int i = 1; i <= n; ++i) {
        ll tmp = i + a[i];
        if(tmp < n) {
            ans += freq[tmp];
        }
    }
    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'llans' was not declared in this scope; did you mean 'llabs'?
   24 |     llans = 0;
      |     ^~~~~
      |     llabs
a.cc:28:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |             ans += freq[tmp];
      |             ^~~
      |             abs
a.cc:31:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include <stdio.h>
#include <iostream>
#include <string.h>

using namespace std;


int main (){
    int a;
    cin >> a;
    long long l, i=0, b[200000],cnt=0;
    while(cin>>l)
    {
        b[i] = l;
        i++;
    }
        for (long long i = 0; i < a; i++)
        {
            for (long long j = i+1; j < a; j++)
            {
                if (abs(j-i))==(b[j]+b[i]))
                {
                    cnt+=1;
                }
                
            }
            
        }
    cout << cnt;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:30: error: expected primary-expression before '==' token
   21 |                 if (abs(j-i))==(b[j]+b[i]))
      |                              ^~
Language: C++

#include <stdio.h>
#include <iostream>
#include <string.h>

using namespace std;


void main (){
    int a;
    cin >> a;
    long long l, i=0, b[200000],cnt=0;
    while(cin>>l)
    {
        b[i] = l;
        i++;
    }
        for (long long i = 0; i < a; i++)
        {
            for (long long j = i+1; j < a; j++)
            {
                if (abs(b[j]-b[i])==(b[j]+b[i]))
                {
                    cnt+=1;
                }
                
            }
            
        }
    cout << cnt;
}

Compiler output:
a.cc:8:1: error: '::main' must return 'int'
    8 | void main (){
      | ^~~~
Language: C++

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);
  for (int i = 0; i < M; i++) {
    cin >> A.at(i) >> B.at(i);
  }

  // ここにプログラムを追記
  // (ここで"試合結果の表"の2次元配列を宣言)
  vector<vector<char>> NO(N, vector<char>(N, '-'));
  for (int i = 0;i < M; i++) {
    NO.at(A.at(i)).at(B.at(i)) = 'o';
    NO.at(B.at(i)).at(A.at(i)) = 'x';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:2: error: expected '}' at end of input
   18 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main(){
        map<long long, long long> agents;
        long long n,a;
        scanf("%lld", &n);
        int count = 0;
        vector<long long> attendee(n);
        for (int& x: attendee){
			scanf("%lld", &x);
		}
        for (int i = n-1; i >= 0 ; i--){
			a = attendee[i];
			agents[i-a]++;
			count += agents[i+a];
		}
		cout << count;
        return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   10 |         for (int& x: attendee){
      |                      ^~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
  ll n, ans = 0, x;
  cin >> n;
  unordered_map<ll, ll> mp;
  for (int i = 1; i <= n; ++i) scanf("%lld", &x), ans += mp[i - x], mp[i + x]++;
  cout << ans << endl return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: expected ';' before 'return'
   11 |   cout << ans << endl return 0;
      |                      ^~~~~~~
      |                      ;