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

import java.util.Scanner;

public class D2 {
    public static void main(String[] args){
        Cal();
    }

    private static void Cal(){
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.nextLine());
        //获得n
        String[] sp = new String[n];
        int[] in = new int[n];
        //以空格为分割划分到一个string数组里面
        int count = 0;
        sp = scan.nextLine().split(" ");
        for(int i = 0; i < n; i ++){
            //转换到int数组里面
            in[i] = Integer.parseInt(sp[i]);
        }
        for(int i = 0; i < n - 1; i ++){
            for(int j = i + 1; j < n; j ++){
                int temp = j - i;
                if(in[i] >= temp || in[j] >= temp)
                    continue;
                if(temp == in[j] + in[i])
                    count ++;
            }
        }
        System.out.print(count);
    }
}


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

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

int main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  int count = 0;
  
  vector<vector<bool>> checked(N, vector<bool>(N, false));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i == j) {
        continue;
      }
      
      if (i > j && i - j == A.at(i) + A.at(j)) {
        count++;
      }
      else if (i < j && j - i == A.at(i) + A.at(j)) {
        count++;
      }
    }
  }
  
  cout << count / 2 << 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: Java

import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        int n = sc.nextInt();
        Map<Long, Long> add = new HashMap<>();
        Map<Long, Long> sub = new HashMap<>();

        for (int i = 1; i <= n; i++) {
            long a = sc.nextLong();
            add.put(i+a, add.getOrDefault(i + a, 0)+1);
            sub.put(i-a, sub.getOrDefault(i - a, 0)+1);
        }

        int ans = 0;
        for(Map.Entry<Long, Long> addentry : add.entrySet()) {
            if (sub.containsKey(addentry.getKey())) {
                ans += addentry.getValue() * sub.get(addentry.getKey());
            }
        }
        System.out.println(ans);
    }
}


Compiler output:
Main.java:17: error: incompatible types: int cannot be converted to Long
            add.put(i+a, add.getOrDefault(i + a, 0)+1);
                                                 ^
Main.java:18: error: incompatible types: int cannot be converted to Long
            sub.put(i-a, sub.getOrDefault(i - a, 0)+1);
                                                 ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
Language: Java

for(int i = 1; i <= N-2; i++) {
            if(A[i] > N-i-1) {
                continue;
            }
            for(int j = i+(int)A[i]+1; j <= N; j++) {
                if(j - i == A[j]+A[i]) {
                    ans++;
                }
            }
        }
        System.out.println(ans);

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
for(int i = 1; i <= N-2; i++) {
^
Main.java:1: error: class, interface, enum, or record expected
for(int i = 1; i <= N-2; i++) {
               ^
Main.java:1: error: class, interface, enum, or record expected
for(int i = 1; i <= N-2; i++) {
                         ^
Main.java:4: error: class, interface, enum, or record expected
            }
            ^
Main.java:5: error: class, interface, enum, or record expected
            for(int j = i+(int)A[i]+1; j <= N; j++) {
                                       ^
Main.java:5: error: class, interface, enum, or record expected
            for(int j = i+(int)A[i]+1; j <= N; j++) {
                                               ^
Main.java:8: error: class, interface, enum, or record expected
                }
                ^
7 errors
Language: C++

#include <iostream>
#include "math.h"
#include <map>
using namespace std;
#define pb push_back
#define fi first
#define se second
typedef long long ll;
int main(){
  ll n; ll a[n];
  map<ll,ll> m; map<<ll,ll>m2;
  for(int i=0;i<n;++i){
  	cin>>a[i];
  	if(m.find(m[a[i]-i])!=m.end())
  		m[a[i]-i]++; else m[a[i]-i]=1;
  	if(m2.find(m[a[i]+i])!=m2.end())
  		m2[a[i]+i]++; else m2[a[i]+i]=1;
  }
  ll an= 0;
  for(auto i: m){
  	if(m2.find(i.se)!=m2.end())
  		an += i.se * m2[i.fi];
  }
  cout<<an<<'\n';
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: expected unqualified-id before '<<' token
   11 |   map<ll,ll> m; map<<ll,ll>m2;
      |                    ^~
a.cc:16:12: error: 'm2' was not declared in this scope; did you mean 'm'?
   16 |         if(m2.find(m[a[i]+i])!=m2.end())
      |            ^~
      |            m
a.cc:21:12: error: 'm2' was not declared in this scope; did you mean 'm'?
   21 |         if(m2.find(i.se)!=m2.end())
      |            ^~
      |            m
Language: Java

import java.util.*;
import static java.lang.*;

class Main {
 
    public static void main (String args[])
    {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        
        int nn=0;
        int[] N=new int[n];
        while(n-->0)
        {
            N[nn]=in.nextInt();
            nn++;
        }
        int count=0;
        for(int i =0;i<N.length-1;i++)
        {
            for(int j=i+1;j<N.length;j++)
            {
                if(j-i==N[i]+N[j]) count++;
            }
        }
        System.out.println(count);
    }
}

Compiler output:
Main.java:2: error: cannot find symbol
import static java.lang.*;
                  ^
  symbol:   class lang
  location: package java
1 error
Language: C++

#include <iostream>
#include "math.h"
#include <map>
using namespace std;
#define pb push_back
#define fi first
#define se second
typedef long long ll;
int main(){
  ll n; ll a[n];
  map<ll,ll> m;
  for(int i=0;i<n;++i){
  	cin>>a[i];
  	if(m.find(m[a[i]-i])!=m.end())
  		m[a[i]-i]++; else m[a[i]-i]=1;
  	if(m2.find(m[a[i]+i])!=m2.end())
  		m2[a[i]+i]++; else m2[a[i]+i]=1;
  }
  ll a = 0;
  for(auto i: m){
  	if(m2.find(i.se)!=m2.end())
  		a += i.se * m2[i.fi];
  }
  cout<<a<<'\n';
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: 'm2' was not declared in this scope; did you mean 'm'?
   16 |         if(m2.find(m[a[i]+i])!=m2.end())
      |            ^~
      |            m
a.cc:19:6: error: conflicting declaration 'll a'
   19 |   ll a = 0;
      |      ^
a.cc:10:12: note: previous declaration as 'll a [n]'
   10 |   ll n; ll a[n];
      |            ^
a.cc:21:12: error: 'm2' was not declared in this scope; did you mean 'm'?
   21 |         if(m2.find(i.se)!=m2.end())
      |            ^~
      |            m
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,c=0;
  cin>>n;
  long int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  for(int j=0;j<n-1;j++)
  {
    for(int k=j+1;k<n;k++)
    {
      	if((k-j)==a[j]+a[k])
          c++;
    }
  }
  return 0;
}
  
3


Compiler output:
a.cc:23:1: error: expected unqualified-id before numeric constant
   23 | 3
      | ^
Language: Java

import java.util.Scanner;

public class Method {

    public static void main(String[] args){
        Cal();
    }

    private static void Cal(){
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.nextLine());
        //获得n
        String[] sp = new String[n];
        int[] in = new int[n];
        //以空格为分割划分到一个string数组里面
        int count = 0;
        sp = scan.nextLine().split(" ");
        for(int i = 0; i < n; i ++){
            //转换到int数组里面
            in[i] = Integer.parseInt(sp[i]);
        }
        for(int i = 0; i < n - 1; i ++){
            for(int j = i + 1; j < n; j ++){
                int temp = j - i;
                if(in[i] >= temp || in[j] >= temp)
                    continue;
                if(temp == in[j] + in[i])
                    count ++;
            }
        }
        System.out.print(count);
    }
}


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

#include <iostream>
#include "math.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
typedef long long ll;
int main(){
  ll n; ll a[n];
  map<ll,ll> m;
  for(int i=0;i<n;++i){
  	cin>>a[i];
  	if(m.find(m[a[i]-i])!=m.end())
  		m[a[i]-i]++; else m[a[i]-i]=1;
  	if(m2.find(m[a[i]+i])!=m2.end())
  		m2[a[i]+i]++; else m2[a[i]+i]=1;
  }
  ll a = 0;
  for(auto i: m){
  	if(m2.find(i.fi)!=m2.end())
  		a += i.se * m2[i.fi];
  }
  cout<<a<<'\n';
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'map' was not declared in this scope
   10 |   map<ll,ll> m;
      |   ^~~
a.cc:3:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    2 | #include "math.h"
  +++ |+#include <map>
    3 | using namespace std;
a.cc:10:9: error: expected primary-expression before ',' token
   10 |   map<ll,ll> m;
      |         ^
a.cc:10:12: error: expected primary-expression before '>' token
   10 |   map<ll,ll> m;
      |            ^
a.cc:10:14: error: 'm' was not declared in this scope
   10 |   map<ll,ll> m;
      |              ^
a.cc:15:12: error: 'm2' was not declared in this scope
   15 |         if(m2.find(m[a[i]+i])!=m2.end())
      |            ^~
a.cc:18:6: error: conflicting declaration 'll a'
   18 |   ll a = 0;
      |      ^
a.cc:9:12: note: previous declaration as 'll a [n]'
    9 |   ll n; ll a[n];
      |            ^
a.cc:20:12: error: 'm2' was not declared in this scope
   20 |         if(m2.find(i.fi)!=m2.end())
      |            ^~
Language: C++

#include<bits/stdc++.h>
#define fastio std::ios_base::sync_with_stdio(false), std::cout.tie(0), std::cin.tie(0);
#define N 100007
#define mxx INT_MAX

typedef long long ll;



int arr[ll];
int main() {
	int num;
	std::cin >> num;
	for (int x = 1; x <= num; x++)std::cin >> arr[x];
	int count = 0;
	for (int x = 1; x <= num; x++) {
		for (int z = x; z <= num; z++) {
			int dif = abs(x-z);
			int sum = arr[x] + arr[z];
			if (sum == dif)count++;
		}
	}
	std::cout << count;


}

Compiler output:
a.cc:10:11: error: expected primary-expression before ']' token
   10 | int arr[ll];
      |           ^
a.cc: In function 'int main()':
a.cc:14:51: error: 'arr' was not declared in this scope
   14 |         for (int x = 1; x <= num; x++)std::cin >> arr[x];
      |                                                   ^~~
a.cc:19:35: error: 'arr' was not declared in this scope
   19 |                         int sum = arr[x] + arr[z];
      |                                   ^~~
Language: C++

#include<stdio.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;
#define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define endl '\n'

const int MAXN=10;
const int MOD=10000000;

int main(){
	int n;
	cin>>n;
	int a[n+1];
	int x[n+1],y[n+1]; 
	int qq=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		x[i]=i + a[i];
		y[i]=i - a[i];
		if(a[i]==0)qq++
	}
	int ans =0 ;
	
	sort(x+1,x+n+1);
	sort(y+1,y+n+1);
	for(int i=1,j=1;i<=n && j<=n;){
		if(x[i] < y[j] )i++;
		else if(x[i] > y[j])j++;
		else {
			int aa=1,bb=1;
			while(x[i+1]==y[j]){
				aa++;i++;
			}
			while(y[j+1]==x[i]){
				bb++;j++;
			}
			ans+=aa*bb;
			i++;j++;
		}
	} 
	cout<<ans - qq<<endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:32: error: expected ';' before '}' token
   24 |                 if(a[i]==0)qq++
      |                                ^
      |                                ;
   25 |         }
      |         ~
Language: C++

#include <iostream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
#include <sstream>

using namespace std;

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vec2bool vector<vector<bool>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s >= 0;s--)

int main()
{
	ll n,ans=0;
	string s;

	cin >> n;

	vecll a(n);

	forll(i, 0, n)
		cin >> a[i];

	vecpairll b(n);

	forll(i, 0, n)
	{
		b[i].first = a[i];
		b[i].second = i + 1;
	}

	sort(b.begin(), b.end());

	for (ll i = n - 1; b[i].first >= n; i--)
		b.pop_back();


Compiler output:
a.cc: In function 'int main()':
a.cc:45:30: error: expected '}' at end of input
   45 |                 b.pop_back();
      |                              ^
a.cc:23:1: note: to match this '{'
   23 | {
      | ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,c=0;
  cin>>n;
  long int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  for(int j=0;j<n-1;j++)
  {
    for(int k=j+1;k<n;k++)
    {
      	if((k-j+2)==a[j]+a[k])
          c++;
    }
  }
  return 0;
}
  
3

Compiler output:
a.cc:23:1: error: expected unqualified-id before numeric constant
   23 | 3
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  vector<int>B(N);
  for(int i=0;i<N;i++)
    B.at(i)=i-A.at(i);
  sort(B.begin(),B.end());
  int64_t ans=0;
  for(int i=0;i<N-1){
   auto itr=lowerbound(B.begin(),B.end(),i+A.at(i));
    auto itr1=upperbound(B.begin(),B.end(),i+A.at(i));
    int64_t k=distance(itr,itr1);
    ans+=k;
  }cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: expected ';' before ')' token
   14 |   for(int i=0;i<N-1){
      |                    ^
      |                    ;
a.cc:15:13: error: 'lowerbound' was not declared in this scope; did you mean 'lround'?
   15 |    auto itr=lowerbound(B.begin(),B.end(),i+A.at(i));
      |             ^~~~~~~~~~
      |             lround
a.cc:16:15: error: 'upperbound' was not declared in this scope
   16 |     auto itr1=upperbound(B.begin(),B.end(),i+A.at(i));
      |               ^~~~~~~~~~
Language: C++

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

int main() {
  int n; cin >> n;
  vec a(n), b(n);
  rep(i,n) {
    cin >> a[i];
    b[i] = a[i] + i;
  }

  sort(b.begin(), b.end());

  ll int c = 0;
  rep(i,n) {
    c += upper_bound(b.begin(), b.end(), i-a[i]) - lower_bound(b.begin(), b.end(), i-a[i]);
  }

  cout << c << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: two or more data types in declaration of 'c'
   18 |   ll int c = 0;
      |   ^~
a.cc:20:5: error: 'c' was not declared in this scope
   20 |     c += upper_bound(b.begin(), b.end(), i-a[i]) - lower_bound(b.begin(), b.end(), i-a[i]);
      |     ^
a.cc:23:11: error: 'c' was not declared in this scope
   23 |   cout << c << endl;
      |           ^
Language: C

include<stdio.h>
int main()
{
int n,i,j,ans;
  ans=0;
 scanf("%d",&n);
  long int a[n];
  for(i=0;i<n;++i)
  {
  scanf("%ld",&a[i]);
  }
  
  for(i=0;i<n-1;++i)
  {if(i+a[i]<n)
     {for(j=i+a[i];j<n;++j)
         {
          if(j-i == a[i]+a[j]) ans++;
          }
      }
  }
  printf("%d",ans);
  
return 0;
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:32: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   13 |             if(j-i == V[i]+V.at[j]){
      |                                ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,c=0;
  cin>>n;
  long int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  for(int j=0;j<n-1;j++)
  {
    for(int k=j;k<n;k++)
    {
      	if(k-j+2)==a[j]+a[k]))
          c++;
    }
  }
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: expected primary-expression before '==' token
   16 |         if(k-j+2)==a[j]+a[k]))
      |                  ^~
Language: C++

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

Compiler output:
a.cc:5:1: error: 'singed' does not name a type; did you mean 'signed'?
    5 | singed main(){
      | ^~~~~~
      | signed
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,c=0;
  cin>>n;
  long int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  for(int j=0;j<n-1;j++)
  {
    for(int k=j;k<n;k++)
    {
      	if(k-j+2)==a[j]+a[k])
        {
          c++;
        }
    }
  }
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: expected primary-expression before '==' token
   16 |         if(k-j+2)==a[j]+a[k])
      |                  ^~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,c=0;
  cin>>n;
  long int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  for(int j=0;j<n-1;j++)
  {
    for(int k=i;k<n;k++)
    {
      	if(k-j+2)==a[j]+a[k])
          c++;
    }
  }
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'i' was not declared in this scope
   14 |     for(int k=i;k<n;k++)
      |               ^
a.cc:16:18: error: expected primary-expression before '==' token
   16 |         if(k-j+2)==a[j]+a[k])
      |                  ^~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:32: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   13 |             if(j-i == V[i]+V.at[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 ans=0;
  for(int i=1;i<=N;i++) {
    for(int j=1;j<=N;j++) {
      if(abs(i-j)==abs(a[i-1]-b[j-1])) {
        ans++;
      }
    }
  }
  
         cout<<ans<<endl;
         return 0;
         
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:31: error: 'b' was not declared in this scope
   13 |       if(abs(i-j)==abs(a[i-1]-b[j-1])) {
      |                               ^
Language: C

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n;
	cin>>n;
	vector<ll> vec(n+1,0);
	for(ll i=1;i<=n;i++){
		cin>>vec[i];
	}
	map<ll,ll> map;
	std::map<ll,ll> ::iterator it;
	ll ans=0;
	for(ll i=1;i<=n;i++){
		it=map.find(i-vec[i]);
		if(it!=map.end()){
			ans+=map[i-vec[i]];
		}
		map[i+vec[i]]++;
	}
	cout<<ans<<endl;
}


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;
int main() {
  int N;
  cin>>N;
  int a[N];
  for(int i=0;i<N;i++) {
    cin>>a[i];
  }
  int ans=0;
  for(int i=1;i<=N;i++) {
    for(int j=1;j<=N;j++) {
      if(abs(i-j)==abs(a[i-1]-b[i-1])) {
        ans++;
      }
    }
  }
  
         cout<<ans<<endl;
         return 0;
         
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:31: error: 'b' was not declared in this scope
   13 |       if(abs(i-j)==abs(a[i-1]-b[i-1])) {
      |                               ^
Language: C

#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>
#include <tuple>

using namespace std;
mt19937_64 rng(58);
typedef long long ll;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) { bool first = true; string res = ""; for (const auto &x : v) { if (!first) res += ", "; first = false; res += to_string(x); } return "{" + res + "}"; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    cin >> n;
    // unordered_map<ll, int> left;
    unordered_map<ll, int> right;

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ll a;
        cin >> a;
        ll l = -a + i;
        ll r = -a + n - 1 - i;
        debug(i, a, l, r);
        // ans += left[a];
        ans += right[a + n - 1 - i];
        debug(ans);
        // left[l]++;
        right[r]++;
    }
    cout << ans << endl;
}

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

#include<iostream>
using namespace std;
int main()
{
  int n,c=0;
  cin>>n;
  long int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  for(int j=0;j<n-1;j++)
  {
    for(int k=i;k<n;k++)
    {
      	if(abs(a[i]-a[k])==k+i)
          c++;
    }
  }
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'i' was not declared in this scope
   14 |     for(int k=i;k<n;k++)
      |               ^
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 ans=0;
  for(int i=1;i<=N;i++) {
    for(int j=1;j<=N;j++) {
      if(abs(i-j)==abs(a[i-1]-b[i-1]) {
        ans++;
      }
         }
         }
         cout<<ans<<endl;
         return 0;
         }

Compiler output:
a.cc: In function 'int main()':
a.cc:13:31: error: 'b' was not declared in this scope
   13 |       if(abs(i-j)==abs(a[i-1]-b[i-1]) {
      |                               ^
a.cc:13:38: error: expected ')' before '{' token
   13 |       if(abs(i-j)==abs(a[i-1]-b[i-1]) {
      |         ~                            ^~
      |                                      )
a.cc:16:10: error: expected primary-expression before '}' token
   16 |          }
      |          ^
Language: C++

#include<cstdio>
#include<map>
using std::map;
map<int,int> m;int a[(int)2*1e5+1],n,ans;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",a+i);
    m[a[1]+1]++;
    for(int i=2;i<=n;i++){
        ans+=m[i-a[i]],m[a[i]+i]++;
    }
    printf("%d\n",ans);
}

Compiler output:
a.cc:4:32: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 | map<int,int> m;int a[(int)2*1e5+1],n,ans;
      |                      ~~~~~~~~~~^~
a.cc:4:32: error: could not convert '(((double)2 * 1.0e+5) + (double)1)' from 'double' to 'long unsigned int'
    4 | map<int,int> m;int a[(int)2*1e5+1],n,ans;
      |                      ~~~~~~~~~~^~
      |                                |
      |                                double
a.cc:4:32: error: size of array 'a' has non-integral type 'double'
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,a[200010],ma,mi=1e9+7,ans;
int main(){
	int i,j,k,l;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a[i];
		ma=max(ma,a[i]);
		mi=min(mi,a[i]);
	}
	for(i=1;i<=n-mi;i++){
		k=min(i+a[i]+ma,n)
		l=i+a[i]+mi;
		for(j=l;j<=k;j++){
			if(j-i==a[i]+a[j])ans++;
		}
	}
	cout<<ans;
	getchar();getchar();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:35: error: expected ';' before 'l'
   13 |                 k=min(i+a[i]+ma,n)
      |                                   ^
      |                                   ;
   14 |                 l=i+a[i]+mi;
      |                 ~
Language: Java

import java.io.*;
import java.util.*;


public class E {

    public static void main(String[] args) {
        new E().run();
    }

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(System.out);
    StringTokenizer tok = new StringTokenizer("");

    void run() {
        try {
            long timeStart = System.currentTimeMillis();
            solve();

            out.close();

            long timeEnd = System.currentTimeMillis();
            System.err.println("Time = " + (timeEnd - timeStart));
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    String readLine() throws IOException {
        return in.readLine();
    }

    String delimiter = " ";

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            String nextLine = readLine();
            if (null == nextLine) return null;

            tok = new StringTokenizer(nextLine);
        }

        return tok.nextToken(delimiter);
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }


    void solve() throws IOException {
        int n = readInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++){
            a[i] = readInt();
        }
        int s = 0;
        for (int i = 0; i < n; i++){
            for (int j = i+1; j < n; j++){
                if(Math.abs(i - j) == a[i] + a[j])
                    s++;
            }
        }
        out.println(s);
    }


}

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

#include <bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

}
int main(){
int n;
cin>>n;
ll a[n];
rep(i,n){
  cin>>a[i];
}
int ans=0;
for(int i=0;i<n-1;i++){

for(int k=i+1;k<n;k++){
if(abs(i-k)==a[i]+a[k]){
  ans++;
}

}
}
cout<<ans<<endl;

  return 0;
}


Compiler output:
a.cc:7:1: error: expected declaration before '}' token
    7 | }
      | ^
Language: Java

import java.util.Scanner;

public class Method {

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.nextLine());
        //获得n
        String[] sp = new String[n];
        int[] in = new int[n];
        //以空格为分割划分到一个string数组里面
        int count = 0;
        sp = scan.nextLine().split(" ");
        for(int i = 0; i < n; i ++){
            //转换到int数组里面
            in[i] = Integer.parseInt(sp[i]);
        }
        for(int i = 0; i < n - 1; i ++){
            for(int j = i + 1; j < n; j ++){
                if(j - i == in[j] + in[i])
                    count ++;
            }
        }
        System.out.print(count);
    }
}


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

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;

int main(){

    int N; cin >> N;
    vector<ll> A(N, 0);
    rep(i,N){
        cin >> A[i];
    }

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

    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'j' was not declared in this scope
   20 |         j = i+A[i]
      |         ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n;
  int arr[n];
  int count=0;
  for(int k=0;k<n;k++)
  {
    cin>>arr[k];
  }
  for(int i=0;i<n;i++)
  {
    for(int j=i;j<n;j++)
    {
      int x= arr[i] + arr[j];
      int y=j-i;
      if(x==y)
      {
        count++;
      }
      else
      {
        return 0;
      }
    }
    cout<<count;
    return 0;
  }

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

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

public class Test {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] list = new int[N];
        int count = 0;

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

        }

        for(int j = 0; j < N - 1; j++) {
        	for(int k = 0; k < N; k++) {
        		int num1 = k - j;
        		int num2 = list[k] + list[j];
        		if(num2 < 0) {
        			num2 = -num2;
        		}
        		if(num1 == num2) {
        			count++;
        		}
        	}
        }

        System.out.println(count);
    }
}

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

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

using namespace std;

int main(){
	int n;
	cin >> n;
	int count{};
	
	
	vector <int> a;
	for(int i=0;i<a.size();++i){
		cin >> a[i];
}	
	for(int i=0;i<a.size();++i){
		for(int j=0;j<a.size();++j){
		   if((a[i] + a[j]) == abs(i-j)){
		   	   count++;
	}
	}}
  cout << count <, endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:18: error: expected primary-expression before ',' token
   23 |   cout << count <, endl;
      |                  ^
Language: C

#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define ff first
#define ss second
const ll mod =   1e9 +7  ;
ll multiply(ll a, ll b ){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////
void solve(){
   // ai + aj = j-i
   // ai+i = j - aj
   int n ;
   cin >> n ;
   map < ll ,  ll > mp ;
   vector < int  > a(n) ;
   for( int i = 0 ; i < n ; i++) cin >> a[i] ;
   for( int i = 0 ; i < n ; i++) mp[a[i]+i+1]++;
   ll ans = 0 ;
   for( int i = 0 ; i < n ; i++){
        ans += mp[i+1-a[i]] ;
   }
   cout << ans ;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1 ;
    //cin >> t ;
    while(t--){
        solve( );
    }
}


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 <stdio.h>
#include <math.h>
int main(){
int n;
  int long long count =0;
  scanf("%d",&n);
  int long long arr[n];
  for(int i=0;i<n;i++){
    scanf("%lld",&arr[i]);
  }
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      if(abs(i-j)==(arr[i]+arr[j]))
         count++;
         }
     }
         printf("%lld",count):
         return 0;
         }

Compiler output:
main.c: In function 'main':
main.c:13:10: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   13 |       if(abs(i-j)==(arr[i]+arr[j]))
      |          ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | int main(){
main.c:17:30: error: expected ';' before ':' token
   17 |          printf("%lld",count):
      |                              ^
      |                              ;
Language: C

#include <stdio.h>
#include <math.h>
int main(){
int n;
  int long long count =0;
  scanf("%d",&n);
  int long long arr[n];
  for(int i=0;i<n;i++){
    scanf("%lld",&arr[i]);
  }
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      if(abs(i-j)==(arr[i]+arr[j])
         count++;
         }
         }
         printf("%lld",count):
         return 0;
         }

Compiler output:
main.c: In function 'main':
main.c:13:10: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   13 |       if(abs(i-j)==(arr[i]+arr[j])
      |          ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | int main(){
main.c:13:35: error: expected ')' before 'count'
   13 |       if(abs(i-j)==(arr[i]+arr[j])
      |         ~                         ^
      |                                   )
   14 |          count++;
      |          ~~~~~                     
main.c:15:10: error: expected expression before '}' token
   15 |          }
      |          ^
main.c:17:30: error: expected ';' before ':' token
   17 |          printf("%lld",count):
      |                              ^
      |                              ;
Language: Java

public class Main {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int number=Integer.parseInt(in.nextLine());
        String height=in.nextLine();
        String[] heights=height.split(" ");
        int[] heightss=new int[heights.length];
        for (int i=0;i<heights.length;i++){
            heightss[i]=Integer.parseInt(heights[i]);
        }
        int sum=0;
        for (int i=0;i<heightss.length;i++){
            for (int j=i+1;j<heightss.length;j++){
                if (heightss[i]+heightss[j]==Math.abs(i-j)){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }
}


Compiler output:
Main.java:3: error: cannot find symbol
        Scanner in=new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner in=new Scanner(System.in);
                       ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

public class EC {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int number=Integer.parseInt(in.nextLine());
        String height=in.nextLine();
        String[] heights=height.split(" ");
        int[] heightss=new int[heights.length];
        for (int i=0;i<heights.length;i++){
            heightss[i]=Integer.parseInt(heights[i]);
        }
        int sum=0;
        for (int i=0;i<heightss.length;i++){
            for (int j=i+1;j<heightss.length;j++){
                if (heightss[i]+heightss[j]==Math.abs(i-j)){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }
}


Compiler output:
Main.java:1: error: class EC is public, should be declared in a file named EC.java
public class EC {
       ^
Main.java:3: error: cannot find symbol
        Scanner in=new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class EC
Main.java:3: error: cannot find symbol
        Scanner in=new Scanner(System.in);
                       ^
  symbol:   class Scanner
  location: class EC
3 errors
Language: C++

#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
using namespace std;

int main(){
  ll n;
  cin>>n;
  ll a[i];
  rep(i,n){
    cin>>a[i];
  }
  map<ll,ll> mp1,mp2,mp3;
  rep(i,n){
    mp1[i+a[i]]++; mp1[i-a[i]]++;
    mp2[i+a[i]]++; mp3[i-a[i]]++;
  }
  ll x=0,y=0,z=0;
  for(auto p:mp1){
    x+=p.second*(p.second-1)/2;
  }
  for(auto p:mp2){
    y+=p.second*(p.second-1)/2;
  }
  for(auto p:mp3){
    z+=p.second*(p.second-1)/2;
  }
  cout<<x-y-z;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:8: error: 'i' was not declared in this scope
   18 |   ll a[i];
      |        ^
a.cc:20:10: error: 'a' was not declared in this scope
   20 |     cin>>a[i];
      |          ^
a.cc:24:11: error: 'a' was not declared in this scope
   24 |     mp1[i+a[i]]++; mp1[i-a[i]]++;
      |           ^
Language: C

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll v[300000],r[300000],l[300000];
int main(){
  int n;
  cin>>n;
  for(int i=1;i<=n;++i){
    cin>>v[i];
    r[min(200000LL,i+v[i])]++;
    l[max(0LL,i-v[i])]++;
  }
  ll ans=0;
  for(int i=1;i<=n;++i){
    ans+=r[i]*l[i];
  }
  cout<<ans;
}

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

public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int number=Integer.parseInt(in.nextLine());
        String height=in.nextLine();
        String[] heights=height.split(" ");
        int[] heightss=new int[heights.length];
        for (int i=0;i<heights.length;i++){
            heightss[i]=Integer.parseInt(heights[i]);
        }
        int sum=0;
        for (int i=0;i<heightss.length;i++){
            for (int j=i+1;j<heightss.length;j++){
                if (heightss[i]+heightss[j]==Math.abs(i-j)){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args){
              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C

public class EC {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int number=Integer.parseInt(in.nextLine());
        String height=in.nextLine();
        String[] heights=height.split(" ");
        int[] heightss=new int[heights.length];
        for (int i=0;i<heights.length;i++){
            heightss[i]=Integer.parseInt(heights[i]);
        }
        int sum=0;
        for (int i=0;i<heightss.length;i++){
            for (int j=i+1;j<heightss.length;j++){
                if (heightss[i]+heightss[j]==Math.abs(i-j)){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }
}


Compiler output:
main.c:1:1: error: unknown type name 'public'
    1 | public class EC {
      | ^~~~~~
main.c:1:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'EC'
    1 | public class EC {
      |              ^~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;
template<typename T>
struct Edge {
    int u, v;
    T cost;
    Edge(int u, int v, T c) : u(u), v(v), cost(c) {}
    bool operator< (const Edge &e) const {return cost < e.cost;}
};

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

string ans;
vector<string> cmds;
map<char, ll> num;

int main(void) {
    int N;
    cin >> N >> num['A'] >> num['B'] >> num['C'];
    rep(i, 0, N) {
        string cmd;
        cin >> cmd;
        cmds.pb(cmd);
    }
    
    if (num['A']+num['B']+num['C']!=2) {
      rep(i, 0, N) {
        string cmd = cmds[i];
        char X = cmd[0], Y = cmd[1];
        if (num[X]>=num[Y]) {
          num[X]--; num[Y]++;
          ans += Y;
        } else {
          num[Y]--; num[X]++;
          ans += X;
        }
        if (num['A']<0 || num['B']<0 || num['C']<0) {
          puts("No");
          return 0;
        }
      
      }
    
    } else {
      vector<int> idxs;
      string notchoice;
      rep(i, 0, N) {
        string cmd = cmds[i];
        char X = cmd[0], Y = cmd[1];
        if (num[X]>num[Y]) {
          num[X]--; num[Y]++;
          ans += Y;
          notchoice += X;
        } else if (num[X]<num[Y]) {
          num[Y]--; num[X]++;
          ans += X;
          notchoice += Y;
        } else if (num[X]==1&&num[Y]==1) {
          num[X]++; num[Y]--;
          ans += X;
          notchoice += Y;
          idxs.pb(i);
        } else {
          if (sz(idxs)==0) {
            puts("No");
            return 0;
          }
          int idx = idxs[sz(idx)-1];
          idxs.pop_back();
          swap(ans[idx], notchoice[idx]);
          num[notchoice[idx]]--;
          
          if (ans[idx]==X) {
            num[Y]++;
            ans += Y;
            notchoice += X;
          } else {
            num[X]++;
            ans += X;
            notchoice += Y;
          
          }
          
        
        }
        
      
      }
      
    
    }

    puts("Yes");
    rep(i, 0, N)cout << ans[i] << endl;
    return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: request for member 'size' in 'idx', which is of non-class type 'int'
   19 | #define sz(v) (int)(v).size()
      |                        ^~~~
a.cc:94:26: note: in expansion of macro 'sz'
   94 |           int idx = idxs[sz(idx)-1];
      |                          ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,a,b,c;
  cin>>n>>a>>b>>c;
  string s;
  bool. flag=true;
  for(int i=1;i<=n;i++)
  {
    cin>>s;
    if(s=="AC")
    {
      if(a>c)
        c++;
      else
        a++;
      b--;
      if(b>=0)
        continue;
      else
      {
        flag=false;
        break;
      }
    }
    if(s=="AB")
    {
      
      if(a>b)
        b++;
      else
        a++;
      c--;
      if(c>=0)
        continue;
      else
      {
        flag=false;
        break;
        
      }
      
      
    }
    if(s=="BC")
    {
      if(b>c)
        c++;
      else
        b++;
      a--;
      if(a>=0)
        continue;
      else
      {
        flag=false;
        break;

      }
      
      
    }

        



      
    
    
    
  }
  if(flag)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: expected unqualified-id before '.' token
    8 |   bool. flag=true;
      |       ^
a.cc:23:9: error: 'flag' was not declared in this scope
   23 |         flag=false;
      |         ^~~~
a.cc:39:9: error: 'flag' was not declared in this scope
   39 |         flag=false;
      |         ^~~~
a.cc:57:9: error: 'flag' was not declared in this scope
   57 |         flag=false;
      |         ^~~~
a.cc:74:6: error: 'flag' was not declared in this scope
   74 |   if(flag)
      |      ^~~~
Language: Java

import java.util.Scanner;

public class ABC166F {

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt(); int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt();
        scan.nextLine();
        char[] ans = new char[n];
        for (int i = 0; i < n; ++i) {
            String s = scan.nextLine();
            if (s.charAt(0)=='A' && s.charAt(1)=='B') {
                if (a > b) {
                    a--;
                    b++;
                    ans[i] = 'B';
                }
                else {
                    a++;
                    b--;
                    ans[i] = 'A';
                }
            }
            else if (s.charAt(0)=='A' && s.charAt(1)=='C') {
                if (a > c) {
                    a--;
                    c++;
                    ans[i] = 'C';
                }
                else {
                    a++;
                    c--;
                    ans[i] = 'A';
                }
            }
            else if (s.charAt(0)=='B' && s.charAt(1)=='C') {
                if (b > c) {
                    b--;
                    c++;
                    ans[i] = 'C';
                }
                else {
                    b++;
                    c--;
                    ans[i] = 'B';
                }
            }
            if (a < 0 || b < 0 || c < 0) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
        for (var e: ans) System.out.println(e);
    }
}

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

import java.util.Scanner;

public class ABC166F {

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt(); int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt();
        scan.nextLine();
        char[] ans = new char[n];
        for (int i = 0; i < n; ++i) {
            String s = scan.nextLine();
            if (s.charAt(0)=='A' && s.charAt(1)=='B') {
                if (a > b) {
                    a--;
                    b++;
                    ans[i] = 'B';
                }
                else {
                    a++;
                    b--;
                    ans[i] = 'A';
                }
            }
            else if (s.charAt(0)=='A' && s.charAt(1)=='C') {
                if (a > c) {
                    a--;
                    c++;
                    ans[i] = 'C';
                }
                else {
                    a++;
                    c--;
                    ans[i] = 'A';
                }
            }
            else if (s.charAt(0)=='B' && s.charAt(1)=='C') {
                if (b > c) {
                    b--;
                    c++;
                    ans[i] = 'C';
                }
                else {
                    b++;
                    c--;
                    ans[i] = 'B';
                }
            }
            if (a < 0 || b < 0 || c < 0) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
        for (var e: ans) System.out.println(e);
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class ABC166F {
      | ^~~~~~