criyle/codenet-compile-errors huggingface dataset:
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 main() {
  int n; 
  cin >> n;
  vector<int> a(n);
  multiset<int> m;
  rep(i,n){
    cin >> a[i];
    m.insert(a[i]);
  }
  
  ll kumi = 0;
  rep(i,n){
    ll x = m.count(i);
    kumi += x * (x - 1) / 2;
  }
  
  rep(k,n){
    ll x = m.count(a[k]);
    cout << kumi - x + 1 << endl;
  }
} 

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

int main() {
  int n; 
  cin >> n;
  vector<int> a(n);
  multiset<int> m;
  rep(i,n){
    cin >> a[i];
    m.insert(a[i]);
  }
  
  ll kumi = 0;
  rep(i,n){
    ll x = m.count(i);
    kumi += x * (x - 1) / 2;
  }
  
  rep(k,n){
    ll x = m.count(a[k]);
    cout << kumi - x + 1 << endl;
  }
} 



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

#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>a[i--];
   vector<int>cnt(n);
  rep(i,n) cnt[a[i]];
  ll tot=0;
  rep(i,n)  tot+=cnt[i]*(cnt[i]-1)/2;
  rep(i,n) {
    ll ans=tot;
    ans-=cnt[a[i]]* (cnt[a[i]]-1)/2;
    ans+=(cnt[a[i]]-2)* (cnt[a[i]]-1)/2
      cout<<ans<<endl;
  }
  
  
  
  
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: warning: ignoring return value of 'std::__debug::vector<_Tp, _Allocator>::reference std::__debug::vector<_Tp, _Allocator>::operator[](size_type) [with _Tp = int; _Allocator = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   13 |   rep(i,n) cnt[a[i]];
      |                    ^
In file included from /usr/include/c++/14/vector:76,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:2:
/usr/include/c++/14/debug/vector:506:7: note: declared here
  506 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
a.cc:19:40: error: expected ';' before 'cout'
   19 |     ans+=(cnt[a[i]]-2)* (cnt[a[i]]-1)/2
      |                                        ^
      |                                        ;
   20 |       cout<<ans<<endl;
      |       ~~~~                              
a.cc:21:4: error: expected '}' at end of input
   21 |   }
      |    ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

int main() 
{
  	ll n;
  	ll a[n];
  	
  	ll fre[100010]={0}
  	for(ll i=0;i<n;i++)
    {
      	cin >> a[i];
      	fre[a[i]]++;
    }
 	
  	ll ans = 0;
  	
  	for(ll i=1;i<=100000;i++)
    {
      	if(fre[i]>=2)
          	ans += (fre[i]*(fre[i]-1))/2;
    }
  
  	for(ll i=0;i<n;i++)
    {
      	if(fre[a[i]]>=2)
        {
          	ll fr = fre[i];
          	fr--;
          	ll tm = ans - (fre[i]*(fre[i]-1))/2;
          	tm =  tm + (fr*(fr-1))/2; 
          	cout << tm << endl;
        }
      	else
          	cout << ans << endl;
    }
  
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: expected ',' or ';' before 'for'
   13 |         for(ll i=0;i<n;i++)
      |         ^~~
a.cc:13:20: error: 'i' was not declared in this scope
   13 |         for(ll i=0;i<n;i++)
      |                    ^
Language: Java

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

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int N = in.i();
        int[] A = in.ii();
        int[] count = new int[N+1];
        for (int i = 0; i < N; i++) {
            count[A[i]]++;
        }
        long sum = 0;
        for (int i = 1; i <= N; i++) {
            sum += (long)count[i] * (count[i] - 1) / 2;
        }
        for (int i = 0; i < N; i++) {
            out.println(sum - count[A[i]] + 1);
        }
        out.flush();
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
}


Compiler output:
Main.java:48: error: reached end of file while parsing
}
 ^
1 error
Language: C++

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
ll chose(ll A){
    return A*(A-1)/2;
}


ll main(){
  ll N;
  cin >> N;
  vector<int> data(N);
  rep(i,0,N) {
      cin >> data[i];
  }
  vector<int> cnt(N,0);
  rep(i,0,N) {
      cnt[data[i]]++;
  }

  ll all;
  ll ans = 0;
  rep(i,0,N){
      all += chose(cnt[i]);
  }
  rep(i,0,N){
      ans = all;
      ans -= chose(cnt[data[i]]);
      ans += chose(cnt[data[i]]-1);
      cout << ans << endl;
  }


  return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
const int INF=0x7fffffff;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
const int N=200005;
int n, a[N], b[N];
ll ans;
int main(){
//	freopen("test.in", "r", stdin);
//	freopen("test.out", "w", stdout); 
	scanf("%d", &n);
	int i;
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]),b[a[i]]++;
	for(i=1;i<=n;i++) ans+=b[a[i]]-1;
	ans/=2;
	for(i=1;i<=n;i++)
		printf("%lld\n", ans-(c[a[i]]-1));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:39: error: 'c' was not declared in this scope
   23 |                 printf("%lld\n", ans-(c[a[i]]-1));
      |                                       ^
Language: Java

import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long N = scan.nextLong();
		int arr[] = new int[N];
		int count[] = new int[N+1];
		long sum = 0;

		for (int i = 0; i < N ; i ++){
			arr[i] = scan.nextInt();
			count[arr[i]] += 1;
		}

		for(int i = 0; i <= N; i++){
			if(count[i] != 0 ){
				sum += count[i] * (count[i] -1) / 2;
			}
		}

		for(int k =0; k < N; k++){
			long ans = sum;
			if(count[arr[k]] > 1){
				ans -= count[arr[k]] * (count[arr[k]] - 1) / 2;
				ans += (count[arr[k]] - 1) * (count[arr[k]] - 2) / 2;
			}
			System.out.println(ans);
		}

	}
}

Compiler output:
Main.java:7: error: incompatible types: possible lossy conversion from long to int
		int arr[] = new int[N];
		                    ^
Main.java:8: error: incompatible types: possible lossy conversion from long to int
		int count[] = new int[N+1];
		                       ^
2 errors
Language: Java

import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long N = scan.nextLong();
		long arr[] = new long[N];
		long count[] = new long[N+1];
		long sum = 0;

		for (int i = 0; i < N ; i ++){
			arr[i] = scan.nextInt();
			count[arr[i]] += 1;
		}

		for(int i = 0; i <= N; i++){
			if(count[i] != 0 ){
				sum += count[i] * (count[i] -1) / 2;
			}
		}

		for(int k =0; k < N; k++){
			long ans = sum;
			if(count[arr[k]] > 1){
				ans -= count[arr[k]] * (count[arr[k]] - 1) / 2;
				ans += (count[arr[k]] - 1) * (count[arr[k]] - 2) / 2;
			}
			System.out.println(ans);
		}

	}
}

Compiler output:
Main.java:7: error: incompatible types: possible lossy conversion from long to int
		long arr[] = new long[N];
		                      ^
Main.java:8: error: incompatible types: possible lossy conversion from long to int
		long count[] = new long[N+1];
		                         ^
Main.java:13: error: incompatible types: possible lossy conversion from long to int
			count[arr[i]] += 1;
			         ^
Main.java:24: error: incompatible types: possible lossy conversion from long to int
			if(count[arr[k]] > 1){
			            ^
Main.java:25: error: incompatible types: possible lossy conversion from long to int
				ans -= count[arr[k]] * (count[arr[k]] - 1) / 2;
				                ^
Main.java:25: error: incompatible types: possible lossy conversion from long to int
				ans -= count[arr[k]] * (count[arr[k]] - 1) / 2;
				                                 ^
Main.java:26: error: incompatible types: possible lossy conversion from long to int
				ans += (count[arr[k]] - 1) * (count[arr[k]] - 2) / 2;
				                 ^
Main.java:26: error: incompatible types: possible lossy conversion from long to int
				ans += (count[arr[k]] - 1) * (count[arr[k]] - 2) / 2;
				                                       ^
8 errors
Language: Java

import java.util.*;

/*
ボールが N個あり、 i番目のボールには整数 
Aiが書かれています。
k=1,2,...,N
 に対して以下の問題を解いて、答えをそれぞれ出力してください。

k 番目のボールを除いた 
N−1 個のボールから、書かれている整数が等しいような異なる 
2 つのボールを選び出す方法の数を求めてください。選ぶ順序は考慮しません。
*/



public class main {
    public static void main(final String[] args){
        //スキャン
        final Scanner s = new Scanner(System.in);
        final int  N =s.nextInt();
        final int[] As = new int[N];
        for(int i = 0;i<=N-1;i++){
            As[i] = s.nextInt();
        }

        
        //kを全て網羅するまで
        for(int k = 0;k<=N-1;k++){
            //組み合わせ数
            int ansCounter = 0;
            //配列内の番号の種類の記録簿
            List<Integer> list = new ArrayList<Integer>();
            //全数列を調査
            for(int i = 0;i <= N-1;i++){
                //番号選出
                Integer select = As[i];
                //番号登録済みかチェック

                if(!list.contains(select)){
                    //登録されてないなら、記録簿に登録
                    list.add(select);
                    //重複数確認
                    int doubled = checker(As,As[i]);
                     //除いた値と一緒だったら、-1
                    if(As[i] == As[k]){
                        doubled--;
                    }
                    //組み合わせ数を計算
                    int addNum = thinker(
                        doubled
                    );
                    ansCounter += addNum;
                }
              
            }
            System.out.println(ansCounter);
            //出力したら初期化
            ansCounter = 0;
            list.clear();
        }

    }

    /**
     * 同一数字カウンター
     * @param Array 対象配列
     * @param target 検索数字
     * @return 同一数
     */
    private static int checker(final int[] Array,final int target){
        int counter =0;
        for(int i2=0; i2 <=Array.length-1;i2++){
            if(Array[i2] == target){
                counter++;
            }
        }
        return counter;
    }

    //重複数から、組み合わせをしらべる
    private static int thinker(Integer times){
        return times*(times-1)/2;
    }

}


Compiler output:
Main.java:16: 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;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}
typedef int long long;
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    map<int,int> mp;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        mp[a[i]]++;
    }
    ll sum = 0;
    for(auto i:mp){
        if(i.second >= 2) sum += i.second*(i.second-1)/2;
    }

    for (int i = 0; i < n; ++i) {
        ll ans = 0,ans2 = 0;
        int tmp,tmp2;
        tmp = mp[a[i]]-1;
        if(tmp >= 2) ans += tmp*(tmp-1)/2;
        tmp2 = mp[a[i]];
        if(tmp2 >= 2) ans2 -= tmp2*(tmp2-1)/2;
        cout << sum+ans+ans2 << endl;
    }
    return 0;
}

Compiler output:
a.cc:14:18: error: declaration does not declare anything [-fpermissive]
   14 | typedef int long long;
      |                  ^~~~
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>;

ll choose2(ll n) {
    return n*(n-1)/2;
}
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) a[i]--;
    vector<int> cnt(n);
    rep(i, n) cnt[a[i]]++;
    ll tot = 0;
    rep(i, n) {
        tot += choose2(cnt[i]);
    }
    rep(i, n) {
        ll ans = tot;
        ans -= choose2(cnt[a[i]]);
        ans += choose2(cnt[a[i]-1]);
        cout << ans << endl;
    }
    return 0;
}

Compiler output:
a.cc:4:12: error: 'Long' does not name a type; did you mean 'long'?
    4 | using ll = Long Long;
      |            ^~~~
      |            long
a.cc:7:1: error: 'll' does not name a type
    7 | ll choose2(ll n) {
      | ^~
a.cc: In function 'int main()':
a.cc:18:5: error: 'll' was not declared in this scope
   18 |     ll tot = 0;
      |     ^~
a.cc:20:9: error: 'tot' was not declared in this scope
   20 |         tot += choose2(cnt[i]);
      |         ^~~
a.cc:20:16: error: 'choose2' was not declared in this scope; did you mean 'close'?
   20 |         tot += choose2(cnt[i]);
      |                ^~~~~~~
      |                close
a.cc:23:11: error: expected ';' before 'ans'
   23 |         ll ans = tot;
      |           ^~~~
      |           ;
a.cc:24:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |         ans -= choose2(cnt[a[i]]);
      |         ^~~
      |         abs
a.cc:24:16: error: 'choose2' was not declared in this scope; did you mean 'close'?
   24 |         ans -= choose2(cnt[a[i]]);
      |                ^~~~~~~
      |                close
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n=0,inp=0;
    cin>>n;
    set<int> s;
    vector<int> A;
    vector<int> count(n+1,0);
    for(int i=0;i<n;i++){
        cin>>inp;
        A.push_back(inp);
        s.insert(inp);
        count[inp]++;
    }
    int total=0;
    for(auto x:s){
        total+=(count[x]*(count[x]-1))/2;
    }
    for(int i=0;i<n;i++){
        if(total<count[A[i]|| total<0]{
            cout<<0<<endl;
        }else{
            cout<<total-count[A[i]]+1<<endl;
        }
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:39: error: expected ')' before '{' token
   20 |         if(total<count[A[i]|| total<0]{
      |           ~                           ^
      |                                       )
a.cc:25:5: error: expected primary-expression before '}' token
   25 |     }
      |     ^
Language: C++

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

ll combination(ll n,ll r) {
  if((n==1)||(n==0))return 0;
  if ( r * 2 > n ) r = n - r;
  ll dividend = 1;
  ll divisor  = 1;
  for (ll i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
 
  return dividend / divisor;
}

ll main()
{
    ll N;
    vector<ll>array;
    map<ll,ll>m;
    ll sum=0;
    cin>>N;
    for(ll i=0;i<N;i++){
        ll a;
        cin>>a;
        array.push_back(a);
        m[array[i]]++;
    }
    for(pair<ll,ll>p:m){
        ll dic=p.second;
        sum+=combination(dic,2);
    }
    for(ll i=0;i<N;i++){

        ll ans=sum-(combination(m[array[i]],2)-combination(m[array[i]]-1,2));
        cout<<to_string(ans)<<endl;
    }
    return 0;
}


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

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

ll nck(ll n, ll k) {
    ll r = 1;
    for (ll d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}

bool check(string s,int n,int m){
    string t=s.substr(n-1,m);
    string u=s.substr(n-1,m);
    reverse(u.begin(),u.end());
    //cout<<t<<endl;
    //cout<<u<<endl;
    if(u==t) return true;
    else return false;
}

int main(){
    //A
    /*
    int N,M;cin>>N>>M;
    if(N<=1&&M<=1) cout<<0<<endl;
    else cout<<nck(N,2)+nck(M,2)<<endl;
    */
   //B
   /*
   string s;cin>>s;
   int N=s.size();
   //string p="akasaka";
   //cout<<p.substr(5,7)<<endl;
   if(check(s,1,N)&&check(s,1,(N-1)/2)&&check(s,(N+3)/2,N-(N+3)/2+1))
        cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   */
  //C
  /*
  double L;cin>>L; //doubleにしないといけないらしい
  cout<<fixed<<setprecision(10);
  cout<<pow(L/3,3)<<endl;
  */
  //D
  int N;cin>>N;
  vector<int> a(N);
  map<int,int> p;
  rep(i,0,N) {
      cin>>a[i];
      p[a[i]]++;
  }
  int tot=0;
  for (auto c:p){ //数字の種類毎に考える autoを使うと連想配列pの総数を考えなくて済むね
      int num=c.first;
      int cnt=c.second;
      tot+=cnt*(cnt-1)/2;
  }
  rep(i,0,N){
      int ans = tot;//ここに帰ってくるときにansの値が元に戻る
      if(p.count(a[i])){
          int cnt=p(a[i]);
          ans-=cnt*(cnt-1)/2;
          ans+=(cnt-1)*(cnt-2)/2;//nC2=n*(n-1)/2
      //ある種類の数字の条件の方法の数を足さなかったとして、代わりにその数字が一つ少ない場合の条件の方法の数を足す
      }
      cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:20: error: no match for call to '(std::map<int, int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   66 |           int cnt=p(a[i]);
      |                   ~^~~~~~
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>
#include <bitset>
#include <cassert>
using namespace std;
/* typedef */
typedef long long ll;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
ll combination2(ll n) {
    return n * (n - 1) / 2;
}
/* main */
int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    vector<ll> cnt(N, 0);
    for (int i = 0; i < N; i++) cnt[A[i]]++;
    ll tot = 0;
    for (int i = 0; i < N; i++) tot += combination2(cnt[i]);
    for (int i = 0; i < N; i++) {
        ll ans = tot;
        ans -= combination2(cnt[A[i]])
        ans += combination2(cnt[A[i]] - 1);
        cout << ans << '\n';
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:39: error: expected ';' before 'ans'
   46 |         ans -= combination2(cnt[A[i]])
      |                                       ^
      |                                       ;
   47 |         ans += combination2(cnt[A[i]] - 1);
      |         ~~~
Language: C++

#include <iostream>
#include <map>
using namespace std;

long long int zuhe(int x)
{
    return x*(x-1)/2;
}

int main()
{
    map<int,int> m;
    map<int,int> m2;

    int l[100005];
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>l[i];
        m[l[i]]++;
    }
    for(iter=m.begin();iter!=m.end();iter++)
    {
        m2[iter->first]=zuhe(iter->second);
    }
     long long int ans=0;
      for(iter=m2.begin();iter!=m2.end();iter++)
        {
            ans+=iter->second;
        }

    for(int i=0;i<n;i++)
    {

        cout<<ans-m[l[i]]+1<<endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'iter' was not declared in this scope
   23 |     for(iter=m.begin();iter!=m.end();iter++)
      |         ^~~~
a.cc:28:11: error: 'iter' was not declared in this scope
   28 |       for(iter=m2.begin();iter!=m2.end();iter++)
      |           ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+7;
ll sum=0,n;
ll a[maxn],b[maxn];
int main()
{
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[a[i]]++;
    }
    for(int i=0;i<n;i++){
        c[i]=b[i]*(b[i]-1)/2;
        sum+=c[i];
    }
    for(int i=0;i<n;i++){
        cout<<sum-b[a[i]]+1<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'c' was not declared in this scope
   15 |         c[i]=b[i]*(b[i]-1)/2;
      |         ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){

    int N;
    cin >> N;

    vector<int> A(N,0);
    vector<int> B(N,0);

    int Sum = 0;

    for (size_t i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    
    for(int i = 0; i < N; i++){
        B[A[i] - 1]++;
    }

    for(int i = 0; i < N; i++){
        Sum += 0.5 * B[i] * (B[i] - 1);
    }

    for(int k = 0; k < N; k++){
        cout << Sum - B[A[k] - 1] - 1 << "\n;
    }

}

Compiler output:
a.cc:30:42: warning: missing terminating " character
   30 |         cout << Sum - B[A[k] - 1] - 1 << "\n;
      |                                          ^
a.cc:30:42: error: missing terminating " character
   30 |         cout << Sum - B[A[k] - 1] - 1 << "\n;
      |                                          ^~~~
a.cc: In function 'int main()':
a.cc:31:5: error: expected primary-expression before '}' token
   31 |     }
      |     ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){

    int N;
    cin >> N;

    vector<int> A(N,0);
    vector<int> B(N,0);

    int Sum = 0;

    for (size_t i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    
    for(int i = 0, i < N; i++){
        B[A[i] - 1]++;
    }

    for(int i = 0; i < N; i++){
        Sum += 0.5 * B[i] * (B[i] - 1);
    }

    for(int k = 0; k < N; k++){
        cout << Sum - B[A[k] - 1] - 1 << "\n";
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: expected ';' before '<' token
   21 |     for(int i = 0, i < N; i++){
      |                     ^~
      |                     ;
a.cc:21:22: error: expected primary-expression before '<' token
   21 |     for(int i = 0, i < N; i++){
      |                      ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){

    int N;
    cin >> N;

    vector<int> A(N,0);
    vector<int> B(N,0);

    int Sum = 0;

    for (size_t i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    
    for(int i = 0, i < N; i++){
        B[A[i] - 1]++;
    }

    for(int i = 0; i < N; i++){
        Sum += 0.5 * B[i] * (B[i] - 1);
    }

    for(int k = 0; k < N; k++){
        cout << Sum - B[A[k] - 1] - 1 << "\n;
    }

}

Compiler output:
a.cc:30:42: warning: missing terminating " character
   30 |         cout << Sum - B[A[k] - 1] - 1 << "\n;
      |                                          ^
a.cc:30:42: error: missing terminating " character
   30 |         cout << Sum - B[A[k] - 1] - 1 << "\n;
      |                                          ^~~~
a.cc: In function 'int main()':
a.cc:21:21: error: expected ';' before '<' token
   21 |     for(int i = 0, i < N; i++){
      |                     ^~
      |                     ;
a.cc:21:22: error: expected primary-expression before '<' token
   21 |     for(int i = 0, i < N; i++){
      |                      ^
a.cc:31:5: error: expected primary-expression before '}' token
   31 |     }
      |     ^
Language: C++

#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

ll choose2(ll n){
    return n * (n - 1) / 2;
}

int main(){
    ll N;
    cin >> N;
    VL A(N);
    rep(i, 0, N) cin >> A[i];

    VL cnt(N + 1)
    rep(i, 0, N) cnt[A[i]]++;

    ll total = 0;
    rep(i, 0, N) total += choose2(cnt[i]);

    rep(k, 0, N){
        ll ans = total;
        ans -= choose2(cnt[A[k]]);
        ans += choose2(cnt[A[k]]- 1);
        cout << ans << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:22: error: expected ',' or ';' before 'for'
    6 | #define rep(i, a, b) for(int i = (a); i < (b); ++i)
      |                      ^~~
a.cc:33:5: note: in expansion of macro 'rep'
   33 |     rep(i, 0, N) cnt[A[i]]++;
      |     ^~~
a.cc:33:9: error: 'i' was not declared in this scope
   33 |     rep(i, 0, N) cnt[A[i]]++;
      |         ^
a.cc:6:39: note: in definition of macro 'rep'
    6 | #define rep(i, a, b) for(int i = (a); i < (b); ++i)
      |                                       ^
Language: C++

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

long long choose2(long long n){
  return n*(n-1)/2;
}

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    a.at(i) -=1;
  }
  vector<long long> cnt(n);
  for(int i=0;i<n;i++){
    cnt.at(a.at(i))++;
  }
  long long total=0;
  for(int i=0;i<n;i++){
    total +=cnt.at(i)*(cnt.at(i)-1)/2
  }
  for(int i=0;i<n;i++){
    int ans=total;
    ans -= choose2(cnt.at(a.at(i))) - choose2(cnt.at(a.at(i))-1);
    cout << ans << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:38: error: expected ';' before '}' token
   22 |     total +=cnt.at(i)*(cnt.at(i)-1)/2
      |                                      ^
      |                                      ;
   23 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str()));
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

int choose2(int n){
    return (n * (n - 1)) / 2;
}

int main(){
    ll N;
    cin >> N;
    VL A(N);
    rep(i, 0, N) cin >> A[i];

    VL cnt(N);
    rep(i, 0, N) ++cnt[A[i]];

    ll total = 0;
    rep(i, 0, N) total += choose2(cnt[i]);

    rep(k, 0, N){
        ll ans = total;
        ans -= choose2(A[k]);
        ans += choose2(A[k] - 1);
        cout << ans << endl;
    }
}


Compiler output:
a.cc: In function 'll string_to_ll(std::string)':
a.cc:20:20: error: a function-definition is not allowed here before '{' token
   20 | bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }
      |                    ^
a.cc:22:19: error: a function-definition is not allowed here before '{' token
   22 | int choose2(int n){
      |                   ^
a.cc:26:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   26 | int main(){
      |         ^~
a.cc:26:9: note: remove parentheses to default-initialize a variable
   26 | int main(){
      |         ^~
      |         --
a.cc:26:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:26:11: error: a function-definition is not allowed here before '{' token
   26 | int main(){
      |           ^
a.cc:44:2: error: expected '}' at end of input
   44 | }
      |  ^
a.cc:19:27: note: to match this '{'
   19 | ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str()));
      |                           ^
Language: Java

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

class GFG{
  public static void main(String[] args){
    int n;
    Scanner sc=new Scanner(System.in);
    n=sc.nextInt();
    int[] arr=new int[n];
    HashMap<Integer,Integer>hm=new HashMap();
    
    for(int i=0;i<n;i++){
    	arr[i]=sc.nextInt();
        if(hm.containsKey(arr[i])==false){
          hm.put(arr[i],1);
        }
        else{
          hm.put(arr[i], hm.get(arr[i])+1);
        }
    }
        //System.out.println(hm);
    int total=0;
    HashMap<Integer,Integer>hm2 = new HashMap();
    for(int i=0;i<n;i++){
      if(hm2.containsKey(arr[i])==false){
       	 int val = hm.get(arr[i]);
        val = (val*(val-1))/2;
        total+=val;
        hm2.put(arr[i],val);
      }
      
    }
    //System.out.println(hm2);
    for(int i=0;i<n;i++){
       int c = hm.get(arr[i]);
       System.out.println(total-(c-1));
    }
    
      
    
    
  }
  
}

Compiler output:
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Language: C++

#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str()));
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

int choose2(int n){
    return (n * (n - 1)) / 2;
}

int main(){
    ll N;
    cin >> N;
    VL A(N);
    rep(i, 0, N) cin >> A[i];

    VL cnt(N);
    rep(i, 0, N) ++cnt[A[i]];

    ll total = 0;
    rep(i, 0, N) total += choose2(cnt[i]);

    rep(k, 0, N){
        ll ans = total;
        ans -= choose2(A[k]);
        ans += choose2(A[k] - 1);
        cout << ans << endl;
    }
}
    

Compiler output:
a.cc:10:1: error: expected initializer before 'typedef'
   10 | typedef long long int lint;
      | ^~~~~~~
a.cc: In function 'll string_to_ll(std::string)':
a.cc:20:20: error: a function-definition is not allowed here before '{' token
   20 | bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }
      |                    ^
a.cc:22:19: error: a function-definition is not allowed here before '{' token
   22 | int choose2(int n){
      |                   ^
a.cc:26:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   26 | int main(){
      |         ^~
a.cc:26:9: note: remove parentheses to default-initialize a variable
   26 | int main(){
      |         ^~
      |         --
a.cc:26:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:26:11: error: a function-definition is not allowed here before '{' token
   26 | int main(){
      |           ^
a.cc:44:2: error: expected '}' at end of input
   44 | }
      |  ^
a.cc:19:27: note: to match this '{'
   19 | ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str()));
      |                           ^
Language: C++

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

long long combi(long long n) {
    return n*(n - 1) /2;
}

int main(){
  map<int,int> mball;
  int N,a;
  long long sum=0,bcombi,acombi;
  vector<int> vball;
  cin >> N;
  for(int i = 0;i < N;i++){
  	cin >> a;
    vball.push_back(a);
    mball[a] += 1;
  }
  for(auto itr = mball.begin(); itr != mball.end(); ++itr) {
        if(itr->second ==  1){
        }else{
        	sum += reball[itr->second];
        }
    }
  for(int i = 0;i < N;i++){
    bcombi=0,acombi=0;
	auto itr = mball.find(vball.at(i));
    if( itr != mball.end()) {
        bcombi = combi((itr->second));
      	acombi = combi((itr->second - 1));
      }
    cout << sum + acombi - bcombi<< endl;
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:24: error: 'reball' was not declared in this scope; did you mean 'vball'?
   22 |                 sum += reball[itr->second];
      |                        ^~~~~~
      |                        vball
Language: C++

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

long long combi(long long n) {
    return n*(n - 1) /2;
}

int main(){
  map<int,int> mball;
  map<int,long long> reball;
  int N,a;
  long long sum=0,bcombi,acombi;
  vector<int> vball;
  cin >> N;
  for(int i = 0;i < N;i++){
  	cin >> a;
    vball.push_back(a);
    mball[a] += 1;
  }
  for(auto itr = mball.begin(); itr != mball.end(); ++itr) {
        if(itr->second ==  1){
        	mball.erase(itr->second);
        }else{
          	reball[itr->second] = combi(itr->second);
        	sum += reball[itr->second];
        }
    }
  for(int i = 0;i < N;i++){
    bcombi=0,acombi=0;
	auto itr = mball.find(vball.at(i));
    if( itr != mball.end()) {
        bcombi = reball[itr->second];
      	acombi = combi((itr->second - 1));
      }
    }
    cout << sum + acombi - bcombi<< endl;
  }
}
}


Compiler output:
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
Language: C++

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

long long combi(long long n) {
    return n*(n - 1) /2;
}

int main(){
  map<int,int> mball;
  map<int,long long> reball;
  int N,a;
  long long sum=0,bcombi,acombi;
  vector<int> vball;
  cin >> N;
  for(int i = 0;i < N;i++){
  	cin >> a;
    vball.push_back(a);
    mball[a] += 1;
  }
  for(auto itr = mball.begin(); itr != mball.end(); ++itr) {
        if(itr->second ==  1){
        	mball.erase(itr->second);
        }else{
          	reball[itr->second] = combi(itr->second);
        	sum += reball[itr->second];
        }
    }
  for(int i = 0;i < N;i++){
    bcombi=0,acombi=0;
	auto itr = mball.find(vball.at(i));
    if( itr != mball.end()) {
        bcombi = reball[itr->second];
      	acombi = combi((itr->second - 1));
      }
    }
    cout << sum + acombi - bcombi<< endl;
  }
  
}


Compiler output:
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
Language: C++

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

ans_l=[0]*(n+1)
ans=0
def con(a):
    return int(a*(a-1)*0.5)
for i in range(n):
    ans_l[l[i]]+=1
#print("ans_l",ans_l)
#print("l",l)
for j in ans_l:
    ans+=con(j)
# print(ans)
for i in range(n):
    ans_2=ans
    # print("ans_2_0:",ans_2)
    #print("ans_l[l[i]]",ans_l[l[i]])
    ans_2-=con(ans_l[l[i]])
    #print("ans_2_1:",ans_2)
    
    #print("ans_l[l[i]]:",ans_l[l[i]]-1)
    ans_2+=con(ans_l[l[i]]-1)
    print(ans_2)

Compiler output:
a.cc:10:2: error: invalid preprocessing directive #print
   10 | #print("ans_l",ans_l)
      |  ^~~~~
a.cc:11:2: error: invalid preprocessing directive #print
   11 | #print("l",l)
      |  ^~~~~
a.cc:14:3: error: invalid preprocessing directive #print
   14 | # print(ans)
      |   ^~~~~
a.cc:17:7: error: invalid preprocessing directive #print
   17 |     # print("ans_2_0:",ans_2)
      |       ^~~~~
a.cc:18:6: error: invalid preprocessing directive #print
   18 |     #print("ans_l[l[i]]",ans_l[l[i]])
      |      ^~~~~
a.cc:20:6: error: invalid preprocessing directive #print
   20 |     #print("ans_2_1:",ans_2)
      |      ^~~~~
a.cc:22:6: error: invalid preprocessing directive #print
   22 |     #print("ans_l[l[i]]:",ans_l[l[i]]-1)
      |      ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n=int(input())
      | ^
Language: C++


 
int main() {
  int n;
  cin >> n;
  vector<int> a(n+1);
  vector<int> b(n);
  rep(i,n) {
      cin >> b[i];
      a[b[i]]++;
  }
  ll ans=0;
  for (int i=1; i<n+1; i++) {
      if(a[i]<2) continue;
      ans+=a[i]*(a[i]-1)/2;
  }
  rep(i,n) {
      if(a[b[i]]<2) cout << ans << endl;
      else if(a[b[i]]==2) {
         
          cout << ans-1 << endl;
      }
      else {
          ll aans=ans-a[b[i]]*(a[b[i]]-1)/2-(a[b[i]]-1)*(a[b[i]]-2)/2;
          cout << aans << endl;
      }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> n;
      |   ^~~
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> a(n+1);
      |   ^~~~~~
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> a(n+1);
      |          ^~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> b(n);
      |          ^~~
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   rep(i,n) {
      |       ^
a.cc:8:3: error: 'rep' was not declared in this scope
    8 |   rep(i,n) {
      |   ^~~
a.cc:12:3: error: 'll' was not declared in this scope
   12 |   ll ans=0;
      |   ^~
a.cc:14:10: error: 'a' was not declared in this scope
   14 |       if(a[i]<2) continue;
      |          ^
a.cc:15:7: error: 'ans' was not declared in this scope
   15 |       ans+=a[i]*(a[i]-1)/2;
      |       ^~~
a.cc:15:12: error: 'a' was not declared in this scope
   15 |       ans+=a[i]*(a[i]-1)/2;
      |            ^
Language: C++

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

int main() {
  int n; cin>>n;
  vector<ll> a(n);
  rep(i, n) cin>>a[i];

  vector<int> X(200001, 0);
  vector<ll> Y(200001, 0);
  rep(i, n) X[a[i]]++;
  ll res=0;
  rep(i, 200001) {
    Y[i]=max(0, (X[i]-1)*X[i]/2);
    res+=Y[i];
  }
  rep(i, n) {
    ll tmp=res-Y[a[i]];
    tmp+=max(0, (ll)(X[a[i]]-1)*(X[a[i]]-2)/2);
    cout<<tmp<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:13: error: no matching function for call to 'max(int, long long int)'
   21 |     tmp+=max(0, (ll)(X[a[i]]-1)*(X[a[i]]-2)/2);
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:21:13: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   21 |     tmp+=max(0, (ll)(X[a[i]]-1)*(X[a[i]]-2)/2);
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:21:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |     tmp+=max(0, (ll)(X[a[i]]-1)*(X[a[i]]-2)/2);
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main()
{
    long long n;
    cin>> n;
    vector<long long> v(n);
    map<long long ,long long> m;
    int maxx=0;
    for(int i=0;i<n;i++)
    {
        cin>> v[i];
        m[v[i]]++;
        maxx=max(maxx,m[v[i]]);

    }

    map<int,int> p;
    long long sum=0;
    for(auto i:m)
    {
        long long a=i.second;
        if(a>=2)
        sum+=a*(a-1)/2;
        
        
    }

    for(int i=0;i<n;i++)
    {
        
        long long res=0;
        if(m[v[i]]>=3)
            res=(m[v[i]]-1)*(m[v[i]]-2)/2;
          long long  ans=0;
        if(m[v[i]]>=2)
        ans=(m[v[i]]*(m[v[i]]-1)/2);
        cout<<sum-ans+res<<endl;
    }

    return 0;



}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: no matching function for call to 'max(int&, std::map<long long int, long long int>::mapped_type&)'
   15 |         maxx=max(maxx,m[v[i]]);
      |              ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:15:17: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::map<long long int, long long int>::mapped_type' {aka 'long long int'})
   15 |         maxx=max(maxx,m[v[i]]);
      |              ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:15:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |         maxx=max(maxx,m[v[i]]);
      |              ~~~^~~~~~~~~~~~~~
Language: Java

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

public class hef {
	

	
	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int a[] = new int[n];
		HashMap<Integer,Integer> h = new HashMap<>();
		for(int i=0;i<n;i++)
		{
			a[i] = s.nextInt();
			if(h.containsKey(a[i])) {
				h.put(a[i], h.get(a[i])+1);
			}
			else {
				h.put(a[i],1);
			}
		}
		
	
		
		int sum = 0;
		for(int i:h.keySet()) {
			sum+=(h.get(i)*(h.get(i)-1))/2;
		}
		
		for(int i=0;i<n;i++) {
			int a1 = h.get(a[i]);
			int ans = sum-((a1)*(a1-1))/2+((a1-1)*(a1-2))/2;
			System.out.println(ans);
		}
		
		
		
		
	}
}

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

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
   for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      if(vec.at(i)==vec.at(j))
        k++;
    }
   }
  for(int i=0;i<N;i++){
    int s=k+1;
    for(int j=0;j<N;j++){
      if(vec.at(i)==vec.at(j))
        s--;
    cout << s << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'k' was not declared in this scope
   14 |         k++;
      |         ^
a.cc:18:11: error: 'k' was not declared in this scope
   18 |     int s=k+1;
      |           ^
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:17:23: note: to match this '{'
   17 |   for(int i=0;i<N;i++){
      |                       ^
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {
  int n;
  cin >> n
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  map<int,int> mp;
  rep (i,n) mp[a[i]]++;
  ll total = 0;
  for (auto i = mp.begin(); i != mp.end(); i++) total += mp[i->first] * (mp[i->first] - 1) / 2;
  rep (i,n) cout << total + 1 - mp[a[i]] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: expected ';' before 'vector'
    8 |   cin >> n
      |           ^
      |           ;
    9 |   vector<int> a(n);
      |   ~~~~~~   
a.cc:10:18: error: 'a' was not declared in this scope
   10 |   for (auto &i : a) cin >> i;
      |                  ^
a.cc:12:16: error: 'a' was not declared in this scope
   12 |   rep (i,n) mp[a[i]]++;
      |                ^
a.cc:15:36: error: 'a' was not declared in this scope
   15 |   rep (i,n) cout << total + 1 - mp[a[i]] << endl;
      |                                    ^
Language: C++

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

int main() {
  int n;
  cin >> n
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  map<int,int> mp;
  rep (i,n) mp[a[i]]++;
  ll total = 0;
  for (auto i = mp.begin(); i != mp.end(); i++) total += mp[i->first] * (mp[i->first] - 1) / 2;
  rep (i,n) cout << ans + 1 - mp[a[i]] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: expected ';' before 'vector'
    8 |   cin >> n
      |           ^
      |           ;
    9 |   vector<int> a(n);
      |   ~~~~~~   
a.cc:10:18: error: 'a' was not declared in this scope
   10 |   for (auto &i : a) cin >> i;
      |                  ^
a.cc:12:16: error: 'a' was not declared in this scope
   12 |   rep (i,n) mp[a[i]]++;
      |                ^
a.cc:15:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |   rep (i,n) cout << ans + 1 - mp[a[i]] << endl;
      |                     ^~~
      |                     abs
a.cc:15:34: error: 'a' was not declared in this scope
   15 |   rep (i,n) cout << ans + 1 - mp[a[i]] << endl;
      |                                  ^