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

class Main {
 
  public static String StringPeriods(String str) {
    boolean flag = false;
    String ans = "";
    for(int i=0;i<str.length();i++){
      String temp = str;
      String substr = str.substring(0,i);
      temp = temp.replaceAll(substr, "");
      if(temp.equals("")) {
    	  flag = true;
    	  ans = substr;
    	  break;
      }
    }
    if(flag) {
    	str = ans;
    }else {
    	str = "-1";
    }
    // code goes here  
    return str;
  }
 
  public static void main (String[] args) {  
    // keep this function call here     
    Scanner sc = new Scanner(System.in);
   int N=sc.nextInt();
   Map<Integer,Integer> map = new HashMap<Integer,Integer>();
   int[] A= new int[N];
   for(int i=0;i<N;i++) {
	   A[i]=sc.nextInt();
	   if(!map.containsKey(A[i])) {
		   map.put(A[i],1);
	   }else {
		   map.put(A[i],map.get(A[i])+1);
	   }
   }
   long anstemp = 0;
   for(Integer key:map.keySet()) {
	   long v = map.get(key);
	   anstemp+=(v*(v-1)/2);
	}
   for(int i=0;i<N;i++) {
	   long ans = anstemp;
	   long v = map.get(A[i]);
	   ans -= (v*(v-1)/2);
	   ans += ((v-1)*(v-2)/2);
	   System.out.println(ans);
   }
   
  }
}
import java.util.*; 
import java.io.*;

class Main {

  public static String StringPeriods(String str) {
    boolean flag = false;
    String ans = "";
    for(int i=0;i<str.length();i++){
      String temp = str;
      String substr = str.substring(0,i);
      temp = temp.replaceAll(substr, "");
      if(temp.equals("")) {
    	  flag = true;
    	  ans = substr;
    	  break;
      }
    }
    if(flag) {
    	str = ans;
    }else {
    	str = "-1";
    }
    // code goes here  
    return str;
  }

  public static void main (String[] args) {  
    // keep this function call here     
    Scanner sc = new Scanner(System.in);
   int N=sc.nextInt();
   Map<Integer,Integer> map = new HashMap<Integer,Integer>();
   int[] A= new int[N];
   for(int i=0;i<N;i++) {
	   A[i]=sc.nextInt();
	   if(!map.containsKey(A[i])) {
		   map.put(A[i],1);
	   }else {
		   map.put(A[i],map.get(A[i])+1);
	   }
   }
   long anstemp = 0;
   for(Integer key:map.keySet()) {
	   long v = map.get(key);
	   anstemp+=(v*(v-1)/2);
	}
   for(int i=0;i<N;i++) {
	   long ans = anstemp;
	   long v = map.get(A[i]);
	   ans -= (v*(v-1)/2);
	   ans += ((v-1)*(v-2)/2);
	   System.out.println(ans);
   }
   
  }
}


Compiler output:
Main.java:54: error: class, interface, enum, or record expected
import java.util.*; 
^
Main.java:55: error: class, interface, enum, or record expected
import java.io.*;
^
2 errors
Language: C++

def main():
  import sys
  input = sys.stdin.readline
  n = int(input())
  a = [int(i) for i in input().split()]
  Ss = set(a)
  s = list(Ss)
  import collections
  c = collections.Counter(a)
  j = 0
  #print(c[a[0]])
  for i in range(len(s)):
    j += int(c[s[i]]*(c[s[i]]-1)/2)
  #print(j)
  for i in range(n):
      print(int(j-(c[a[i]]-1)))
if __name__ == '__main__':
    main()


Compiler output:
a.cc:11:4: error: invalid preprocessing directive #print
   11 |   #print(c[a[0]])
      |    ^~~~~
a.cc:14:4: error: invalid preprocessing directive #print
   14 |   #print(j)
      |    ^~~~~
a.cc:17:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   17 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def main():
      | ^~~
Language: C++

#include<iostream>
using namespace std;

int ncr(int);
int factor(int);
int count(int *a, int c, int n,int ig);

#define R 2

int main(){
    long long int n,i,j,a[200000],c;
    long long int max;

    cin >> n;
    for( i = 0; i < n; i++){
        cin >> a[i];
    }
/*  表示するだけ
    for( i = 0; i < n; i++){
        cout << a[i] << "\n";
    }
*/
    // k=0~n-1でnCrを計算
    for( i = 0; i < n; i ++){
//        cout << ncr( count(a, a[i], n, i) ) << "\n";

        // ユニークかつAkでないAiの列挙
        max = 0;
        c = 0;
        for( j = 0; j < n; j++ ){
            if( ( max < a[j] ) && ( i != j ) ){
//                cout << a[j] << " ";
                max = a[j];
                c += ncr( count(a, a[j], n, i) );
            }
        }
//        cout << "\n";
        cout << c << "\n";
    }

}

int ncr(int n){
    return factor(n)/(R * factor(n-R));
}

int factor(int n){
    int i,res = 1;
    for( i = 1; i <= n; i++ ){
        res *= i;
    }

    return res;
}

int count(int *a, int c, int n,int ig){
    int i,res = 0;;

    for( i = 0; i < n; i++){
        if( i != ig ){
//            cout << a[i] << " ";
            if( a[i] == c ){
                res++;
            }
        }
    }
//    cout << "\n";

    return res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:33: error: cannot convert 'long long int*' to 'int*'
   34 |                 c += ncr( count(a, a[j], n, i) );
      |                                 ^
      |                                 |
      |                                 long long int*
a.cc:6:16: note:   initializing argument 1 of 'int count(int*, int, int, int)'
    6 | int count(int *a, int c, int n,int ig);
      |           ~~~~~^
Language: Java

import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class D_159 {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int N = scan.nextInt();
			int[]A = new int[N];
			for(int i= 0;i<N;i++) {
				A[i] = scan.nextInt();
			}
			
			Map<Integer,Integer>map = new TreeMap<Integer,Integer>();
			
			for(int i = 0;i<N;i++) {
				if(map.containsKey(A[i])) {
					map.put(A[i], map.get(A[i])+1);
				}else{
					map.put(A[i], 1);
				
				}
			}
			long goukei2 =0;
			
			for(Integer key:map.keySet()) {
				if(map.get(key)>1) {
					goukei2+=sa(map.get(key),2);
				}
			}
			for(int i= 0;i<N;i++) {
				long goukei = 0;
				goukei +=goukei2;
				goukei-=sa(map.get(A[i]),2);
				goukei+=sa(map.get(A[i])-1,2);
				System.out.println(goukei);
			}
			
		}
		
		
	}
	
	private static int sa(int n,int b) {
		return n*(n-1)/b;
	}
	

}


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

#include "bits/stdc++.h"

using namespace std;

#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define reP(i, x, n) for(int i=x; i<n; i++)
#define aLL(x) x.begin(), x.end()
#define pB push_back
#define eB emplace_back
#define tRav(a, x) for(auto& a: x)
#define fI first
#define sE second
#define lB lower_bound
#define uB upper_bound
#define MOD 1000000007

typedef vector<int> vec;
typedef long long ll;
typedef unsigned long long ull;


int main(){
    fast_cin();
    int n;cin>>n;
    map<int, int> m;
    vec v(n);
    int ans =0;
    reP(i, 0, n){
    	cin>>v[i];
    	ans+=m[v[i]];
    	m[x]++;
    }
    for(int i=0;i<n;i++){
    	ans-=m[v[i]]-1;
    	cout<<ans<<endl;
    	ans+=m[v[i]] - 1;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: 'x' was not declared in this scope
   31 |         m[x]++;
      |           ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i  ;
        //inv[i] = MOD - inv[MOD%i] * (MOD / i)  ;
        //finv[i] = finv[i - 1] * inv[i]  ;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] / fac[k] / fac[n - k]  ;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int a[400010];
    // 前処理
    //COMinit();
    
    for (int i=0;i<n;i++) {
        cin >> a[i];
    }
    map<int, > intm;
    for (int i=0;i<n;i++) {
        m[a[i]] = m[a[i]] + 1;
    }
    int sum = 0;
    for (const auto& x : m) {
        sum += x.second * (x.second-1) / 2;
    }
    for (int i=0; i<n; i++) {
        // if (even[a[i]]){
        //     cout << sum - COM() << "\n";
        // } else {
        //     cout << sum << "\n";
        // }
        // if (m[a[i]] - 1 >= 0) {
            int res = sum - m[a[i]] * (m[a[i]]-1)/2  + (m[a[i]]-2) * (m[a[i]]-1)/2;
            cout << res << "\n";
        // } else {
        //     cout << sum << "\n";
        // }
        
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:63:14: error: template argument 2 is invalid
   63 |     map<int, > intm;
      |              ^
a.cc:63:14: error: template argument 4 is invalid
a.cc:65:9: error: 'm' was not declared in this scope
   65 |         m[a[i]] = m[a[i]] + 1;
      |         ^
a.cc:68:26: error: 'm' was not declared in this scope
   68 |     for (const auto& x : m) {
      |                          ^
a.cc:78:29: error: 'm' was not declared in this scope
   78 |             int res = sum - m[a[i]] * (m[a[i]]-1)/2  + (m[a[i]]-2) * (m[a[i]]-1)/2;
      |                             ^
Language: Java

import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class D_159 {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int N = scan.nextInt();
			int[]A = new int[N];
			
			for(int i= 0;i<N;i++) {
				A[i] = scan.nextInt();
			}
			
			Map<Integer,Integer>map = new TreeMap<Integer,Integer>();
			
			for(int i = 0;i<N;i++) {
				if(map.containsKey(A[i])) {
					map.put(A[i], map.get(A[i])+1);
					//System.out.println("ok");
				}else{
					map.put(A[i], 1);
					//System.out.println("no");
				}
			}
			
			
			for(int i= 0;i<N;i++) {
				int goukei =0;
				//if(map.get(A[i])>1) {
				
				for(Integer key:map.keySet()) {
					if(map.get(key)>1)
						goukei+=sa(map.get(key),2);
				}
				
				
				if(map.get(A[i])>1) {
					goukei-=sb(map.get(A[i])-1,1);
					System.out.println(goukei);
				}else {
					System.out.println(goukei);
				}
			}
			
			
			
			
			
			
			
		}
		
		
	}
	
	private static int sa(int n,int b) {
		return n*(n-1)/b;
	}
	
	private static int sb(int n,int b) {
		return n;
	}
	

}

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

#include<stdio.h>
int main(){
	int N,An=0;
	int A[200000];
	int B[200000]={0};
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%d",&A[i]);
		B[A[i]]++;
	}
	for(int i=0;i<N;i++){
		Bn+=B[i]*(B[i]-1)/2;
	}
	int Bn;
	for(int i=0;i<N;i++){
		Bn=An;
		Bn-=B[A[i]]*(B[A[i]]-1)/2;
		Bn+=(B[A[i]]-1)*(B[A[i]]-2)/2;
		printf("%d\n",Bn);
	}
}

Compiler output:
main.c: In function 'main':
main.c:12:17: error: 'Bn' undeclared (first use in this function); did you mean 'B'?
   12 |                 Bn+=B[i]*(B[i]-1)/2;
      |                 ^~
      |                 B
main.c:12:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

#define int long long

#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
    int n;
    cin >> n;
    vector<int> a(n, 0);
    map<int, int> m;
    rep(i, n)
    {
        cin >> a[i];
        m[a[i]]++;
    }

    int ans = 0;
    for (auto j = m.begin(); j != m.end(); ++j)
    {
        ans += j->second * (j->second - 1) / 2;
    }

    rep(i, n)
    {
        cout << ans - (m[a[i]] - 1) << endl;
    }

    return 0;
}


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

#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;

itn N;
itn A[202020];
int B[202020];
int C[202020];


void solve() {
    int tmp = 0;
    FOR(N) {
        C[i] = B[i] * (B[i] - 1) / 2;
        tmp += C[i];
    }
    FOR(N) {
        int a = A[i];
        int b = B[a] - 1;
        int ans = tmp - C[a] + (b >= 1 ? b * (b - 1) / 2 : 0);
        cout << ans << ' ';
    }
    cout << "\n"
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(i, 0, N) {
        cin >> A[i];
        A[i]--;
        B[A[i]]++;
    }


    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:84:17: error: expected ';' before '}' token
   84 |     cout << "\n"
      |                 ^
      |                 ;
   85 | }
      | ~
Language: C

#include<stdio.h>
int main(){
    int n;scanf("%d",&n);
    int a[300000];
  	int cnt[300000]={};
  	for(int i=0;i<n;i++){
    	scanf("%d",&a[i]);
      	cnt[a[i]-1]++;
    }

    long long nPr[300000]={},sum=0;
    for(int i=0;i<n;i++){
        long long x=cnt[i]*(cnt[i]-1);
        nPr[i]=x/2;
        sum+=nPr[i];
    }
 
    //printf("sum:%lld\n",sum);
    for(int i=0;i<n;i++){
        ll x=(cnt[a[i]-1]-1);
        x*=(cnt[a[i]-1]-2);
        x/=2;
        printf("%lld\n",sum-nPr[a[i]-1]+x);
    }
}

Compiler output:
main.c: In function 'main':
main.c:20:9: error: unknown type name 'll'
   20 |         ll x=(cnt[a[i]-1]-1);
      |         ^~
Language: C++

#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(ll i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;
 
const ll mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
 
mint ncr(ll n, ll k) {
  mint a = 1, b = 1;
  for (ll i = 0; i < k; i++) a *= n - i;
  for (ll i = 1; i <= k; i++) b *= i;
  return a / b;
}
 
int main() {
    ll N;
    cin >> N;
    vl a(N);
    map<ll, ll> mp;
    rep(i, 0, N) {
        cin >> a[i];
        mp[a[i]]++;
    }
    //ll dp[3000000];
    //fill(dp, dp+3000000, -1);
    ll res = 0;
        for(auto x : mp) {
            auto ans = ncr(x.second, 2);
            //dp[x.second] = ans.x;
            res += ans.x;
        }


    rep(i, 0, N) {
        ll temp = res;
        ll m = mp[a[i]];
        mp[a[i]]--;
                //if (dp[m] != -1) {
                //    temp -= dp[m];
                //} else {
                    auto ans = ncr(m, 2);
                    temp -= ans.x;
                //}

                //if (dp[mp[a[i]]] != -1) {
                //    temp += dp[mp[a[i]]];
                //} else {
                    auto ans = ncr(mp[a[i]], 2);
                //    dp[mp[a[i]]] = ans.x;
                    temp += ans.x;
                //}
        cout << temp << endl;
        mp[a[i]]++;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:111:26: error: conflicting declaration 'auto ans'
  111 |                     auto ans = ncr(mp[a[i]], 2);
      |                          ^~~
a.cc:104:26: note: previous declaration as 'mint ans'
  104 |                     auto ans = ncr(m, 2);
      |                          ^~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<map>
using namespace std;
map<int,int>m;
map<int ,int> ::iterator it;
int a[222222];
char tt[22222];
char sum[22222];
void jia(long long n)
{
    memset(tt,0,sizeof(tt));
    int p=0;
    while(n)
    {
        tt[p++]=n%10+'0';
        n/=10;
    }
    tt[p]='\0';
    int s=0;
    int i;
    for( i=0;sum[i]!='\0'||tt[i]!='\0';i++)
    {
        if(sum[i]=='\0')
        {
            int ss=tt[i]-'0'+s;
            sum[i]=ss%10+'0';
            s=s/10;
        }
        else if(tt[i]=='\0')
        {
            int ss=sum[i]-'\0'+s;
            sum[i]=ss%10+'0';
            s=ss/10;
        }
        else
        {
            int ss=sum[i]+tt[i]+s-2*'0';
            sum[i]=ss%10+'0';
            s=ss/10;
        }
    }
    if(s>0) sum[i]='1';
}
void jian(long long n)
{
    memset(tt,0,sizeof(tt));
    int p=0;
    while(n)
    {
        tt[p++]=n%10+'0';
        n/=10;
    }
    tt[p]='\0';
    int s=0;
    int sh,xa;int i;
    for( i=0;sum[i]!='\0';i++)
    {
        sh=sum[i]-'0'-s;
        s=0;
        if(tt[i]!='\0') xa=tt[i]-'0';
        else xa=0;
        if(sh>=xa) sum[i]=sh-xa+'0';
        else {
            sum[i]=10+sh-xa+'0';s=1;
        }
    }
    if(sum[i-1]=='0') sum[i-1]=0;
}
int main()
{
    long long n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(m.count(a[i])==0) m[a[i]]=1;
        else m[a[i]]++;
    }
    for(it=m.begin();it!=m.end();it++)
        if(it->second>=2) jia(it->second*(it->second-1)/2);
    for(int i=1;i<=n;i++)
    {
        jian(m[a[i]]-1);
        for(int j=strlen(sum)-1;j>=0;j--) putchar(sum[j]);
        jia(m[a[i]]-1);
        puts("");
    }
    
}


Compiler output:
a.cc: In function 'void jia(long long int)':
a.cc:14:5: error: 'memset' was not declared in this scope
   14 |     memset(tt,0,sizeof(tt));
      |     ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<map>
  +++ |+#include <cstring>
    6 | using namespace std;
a.cc: In function 'void jian(long long int)':
a.cc:49:5: error: 'memset' was not declared in this scope
   49 |     memset(tt,0,sizeof(tt));
      |     ^~~~~~
a.cc:49:5: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc: In function 'int main()':
a.cc:87:19: error: 'strlen' was not declared in this scope
   87 |         for(int j=strlen(sum)-1;j>=0;j--) putchar(sum[j]);
      |                   ^~~~~~
a.cc:87:19: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: Java

import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		int[] count = new int[N];
		int ans = 0;
		int i;
		for(i = 0;i < N;i++){
			A[i] = sc.nextInt();
			count[A[i] - 1]++;
		}
		for(i = 0;i < N;i++){
			if(count[A[i] - 1] != 0){
				count[A[i] - 1]--;
				ans = Sum(count,N);
				System.out.println(ans);
				count[A[i] - 1]++;
				ans = 0;
			}else{
				System.out.println(ans);
			}
		}
	}
	public static int comb(int n,int m){
		if(n < m || n == 0){
			return 0;
		}
		return Factorial(n) / (Factorial(m) * Factorial(n - m));
	}
	public static int Factorial(int i){
		if(i = 0){
			return 1;
		}
		int ans = 1;
		while(i > 0){
			ans *= i;
			i--;
		}
		return ans;
	}
	public static int Sum(int[] a,int n){
		int ans = 0;
		for(int i = 0;i < n;i++){
			ans += comb(a[i],2);
		}
		return ans;
	}
	
}

Compiler output:
Main.java:33: error: incompatible types: int cannot be converted to boolean
		if(i = 0){
		     ^
1 error
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: expected ';' before 'i'
   15 |   for (int i = 0; i < N i++){
      |                        ^~
      |                        ;
Language: C++

#include "pch.h"
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <set>


using namespace std;

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


int main()
{
	int N;
	cin >> N;
	vector<int> balls(N+1);
	vector<int> count(N+1);
	//unordered_multiset<int> ballscount;



	long long ans = 0;
	long long tot = 0;

	for (int i = 1; i <= N; i++)
	{
		int a;
		cin >> a;
		balls[i] = a;
	}

	for (int i = 0; i <= N; i++)
	{
		count[balls[i]]++;
	}

	for (int i = 0; i <= N; i++)
	{
		tot += combination2(count[i]);
	}



	for (int i = 1; i <= N; i++)
	{
		ans = tot;
		ans -= combination2(count[balls[i]]);
		ans += combination2(count[balls[i]] - 1);
		cout << ans << endl;
	}



	return 0;
}

Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C

#include<stdio.h>

int main(){
    int n,i;
    scanf("%d",&n);
    int a[n]
    long long int b[n+1], c=0, d=0;
    for(i=1;i<=n;i++){
        b[i]=0;
    }
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        b[a[i]]++;
    }
    for(i=1;i<=n;i++){
        if(b[i]>1){
            c += b[i]*(b[i]-1)/2;
        }
    }
    for(i=0;i<n;i++){
        if(b[a[i]]>1){ d = b[a[i]]-1; }
        printf("%lld\n",c-d);
        d = 0;
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:13: error: expected ';' before 'long'
    6 |     int a[n]
      |             ^
      |             ;
    7 |     long long int b[n+1], c=0, d=0;
      |     ~~~~     
main.c:12:21: error: 'a' undeclared (first use in this function)
   12 |         scanf("%d",&a[i]);
      |                     ^
main.c:12:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main(){
  // NとAの読み込み
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  // Aの値がインデックスで、その個数が値
  vector<int64_t> C(N+1);
  for(int value : A){
    C.at(value)++;
  }
  // k番目を抜かない全組み合わせMを求める
  int64_t M = 0;
  for(int i=0;i<N+1;i++){
    M += max(0, C.at(i)*(C.at(i)-1)/2);
  }
  // 出力
  for(int k=0;k<N;k++){
    cout << M - C.at(A.at(k)) + 1 << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)'
   20 |     M += max(0, C.at(i)*(C.at(i)-1)/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:20:13: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'})
   20 |     M += max(0, C.at(i)*(C.at(i)-1)/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:20:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   20 |     M += max(0, C.at(i)*(C.at(i)-1)/2);
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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



int main() {
  int n,sum,ans;
  vector<int> v;
  vector<int> cnt;
  vector<int> num;
  cin>>n;
  for(int i=0;i<n;i++){//0番目から数字を入れていく
    int tmp;
    cin>>tmp;
    v.push_back(tmp);
  }
  for(int i=1;i<=n;i++){
    int tmp;
    tmp=count(v.begin(),v.end(),i);//1からnまでの数を数える
    num.push_back(tmp);
    if(tmp>0){ 
      tmp=tmp*(tmp-1)/2;//1個以上あったら通り数を計算する
    }
    cnt.push_back(tmp);//1~nの通り数をcntに収める
  }
  sum=accumulate(cnt.begin(),cnt.end(),0);//通り数の和を計算する
  for(int i=0;i<n;i++){
    int num;
    ans=sum;
    if(cnt[v[i]-1]!=0){//
      ans-=cnt[v[i]-1];
      ans+=(num[v[i]]-1)*(num[v[i]]-2)/2;

    }
   cout<<ans<<endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:32:16: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   32 |       ans+=(num[v[i]]-1)*(num[v[i]]-2)/2;
      |                ^
a.cc:32:30: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   32 |       ans+=(num[v[i]]-1)*(num[v[i]]-2)/2;
      |                              ^
Language: Java

import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		int[] buf = new int[N];
		int[] count = new int[N];
		int ans = 0;
		int i;
		for(i = 0;i < N;i++){
			A[i] = sc.nextInt();
		}
		for(i = 0;i < N;i++){
			System.arraycopy(A,0,buf,0,A.length);
			buf[i] = 0;
			Arrays.sort(buf);
			for(int k = 0;k < N;k++){
				count[buf[i]]++;
			}
			ans = Sum(count,N);
			System.out.println(ans);
			ans = 0;
			fill(count,0);
		}
	}
	public static int comb(int n,int m){
		int N = n;
		int M = m;
		int M2 = m;
		return Factorial(n) / (Factorial(M) * Factorial(n - M2));
	}
	public static int Factorial(int i){
		int ans = 1;
		while(i > 0){
			ans *= i;
			i--;
		}
		return ans;
	}
	public static int Sum(int[] a,int n){
		int ans = 0;
		for(int i = 1;i < n;i++){
			ans += a[i];
		}
		return ans;
	}
	
}

Compiler output:
Main.java:24: error: cannot find symbol
			fill(count,0);
			^
  symbol:   method fill(int[],int)
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		int[] buf = new int[N];
		int count;
		int ans = 0;
		int i;
		for(i = 0;i < N;i++){
			A[i] = sc.nextInt();
		}
		System.arraycopy(A,0,buf,A.length)
		for(i = 0;i < N;i++){
			count = 1;
			System.arraycopy(A,0,buf,0,A.length);
			buf[i] = 0;
			Arrays.sort(buf);
			for(int k = 0;k < N;k++){
				if(k == N - 1){
					if(count != 1){
						ans += comb(count,2);
						count = 1;
					}
				}
				else if(count != 1 && buf[k] != buf[k+1]){
					ans += comb(count,2);
					count = 1;
				}else if(buf[k] == buf[k+1]){
					count++;
				}
			}
			System.out.println(ans);
			ans = 0;
		}
	}
	public static int comb(int n,int m){
		int N = n;
		int M = m;
		int M2 = m;
		return Factorial(n) / (Factorial(M) * Factorial(n - M2));
	}
	public static int Factorial(int i){
		int ans = 1;
		while(i > 0){
			ans *= i;
			i--;
		}
		return ans;
	}
	
}

Compiler output:
Main.java:14: error: ';' expected
		System.arraycopy(A,0,buf,A.length)
		                                  ^
1 error
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int N
    long long ans = 0;
    cin >> N;
    vector<int> A(N), B(N);
    for(int i = 0; i < N; ++i) 
    {
        cin >> A.at(i);
        B.at(A.at(i) - 1)++;
    }
    for(int i = 0; i < N; ++i) ans += B.at(i)*(B.at(i) - 1)/2;
    for(int i = 0; i < N; ++i) cout << ans - B.at(A.at(i) - 1) + 1 <<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: expected initializer before 'long'
   15 |     long long ans = 0;
      |     ^~~~
a.cc:16:12: error: 'N' was not declared in this scope
   16 |     cin >> N;
      |            ^
a.cc:23:32: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |     for(int i = 0; i < N; ++i) ans += B.at(i)*(B.at(i) - 1)/2;
      |                                ^~~
      |                                abs
a.cc:24:40: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |     for(int i = 0; i < N; ++i) cout << ans - B.at(A.at(i) - 1) + 1 <<endl;
      |                                        ^~~
      |                                        abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<(int)N;i++)
int main()
{
  int N,x,y,sum=0;
  map<int,int> mp;
  cin>>N;
  vector<int> A(N,0);
  rep(i,N){cin>>x;mp[x]++;A.at(i)=x;}
  for(auto p:mp)
  {
    auto key=p.first;auto value=p.second;
    sum+=value*(value-1)/2;
  }
  rep(i,N){x=A.at(i);y=mp.at(x);cout<<sum-y*(y-1)/2+(y-1)*(y-2)/2<<endl;}
}#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<(int)N;i++)
typedef vector<vector<int>> Matrix;
const int INF=1<<30;
int main()
{
  int N,x,y,z,sum=0;
  map<int,int> mp;
  cin>>N;
  vector<int> A(N,0);
  rep(i,N){cin>>x;mp[x]++;A.at(i)=x;}
  for(auto p:mp)
  {
    auto key=p.first;auto value=p.second;
    sum+=value*(value-1)/2;
  }
  rep(i,N){x=A.at(i);y=mp.at(x);cout<<sum-y*(y-1)/2+(y-1)*(y-2)/2<<endl;}
}v

Compiler output:
a.cc:17:2: error: stray '#' in program
   17 | }#include<bits/stdc++.h>
      |  ^
a.cc:17:3: error: 'include' does not name a type
   17 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:22:5: error: redefinition of 'int main()'
   22 | int main()
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
a.cc:35:2: error: 'v' does not name a type
   35 | }v
      |  ^
Language: Java

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

/*
説明
*/
public class Main {
    public static void main(String[] args){

        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[] = new int[n];

        HashMap<Integer, Long> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            a[i] = s.nextInt();

            if (!map.containsKey(a[i])) {
                map.put(a[i], 1);
            } else {
                map.put(a[i], map.get(a[i])+1);
            }
        }

        long all = 0;
        // 全通りを求める
        for (int key :map.keySet()) {
            all += map.get(key) * (map.get(key) - 1) / 2;
        }

        for (int i = 0; i < n; i++) {
            long tmp = map.get(a[i]);
            System.out.println(all - (tmp - 1));
        }
    }
}

Compiler output:
Main.java:19: error: incompatible types: int cannot be converted to Long
                map.put(a[i], 1);
                              ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

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

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    vector<ll> p(N)={0};
    rep(i,N) p[A[i]]++;
    ll ans = 0;
    rep(i,N) {
        if (p[i] > 1) ans += (p[i]*(p[i]-1))/2;
    }
    rep(i,N) {
        if (p[A[i]] > 1) cout << ans-((p[A[i]]*(p[A[i]]-1)/2-(p[A[i]]-1)*(p[A[i]]-2)/2)) << endl;
        else cout << ans << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: expected ',' or ';' before '=' token
   12 |     vector<ll> p(N)={0};
      |                    ^
Language: C++

#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<b)return 0; a=b; return 1;}



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll n;
    cin>>n;
    ll a[n];
    ll cnt[n]={};
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i]--;
        cnt[a[i]]++;
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        ans += cnt[i] * (cnt[i] - 1)/2;
    }
    for(int i=0;i<n;i++){
        ll ret = ans - cnt[a[i]]*(cnt[a[i]]-1)/2;
        ret += (cnt[a[i]]-1) * (cnt[a[i]]-2)/2;
        cout << ret << "\n;
    }
    
    
}


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

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
 
ll n, a[202020], s[202020];
 
int main(){
  cin >> n;
  rep(i, n){
    cin >> a[i];
    s[a[i]]++;
  }
  
  //rep(i, n)cout << s[i + 1] << " ";cout << endl;
  
  ll sum = 0;
  for(int i = 1; i <= n; i++){
    sum += (s[i] * (s[i] - 1)) / 2;
  }
  //cout << sum << endl;
  
  for(int i = 1; i <= n; i++){
    ll res = sum;
    res -= s[a[i - 1]] - 1;
    cout << res << endl;
  }
  
  return 0;
}
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

ll n, a[202020], s[202020];

int main(){
  cin >> n;
  rep(i, n){
    cin >> a[i];
    s[a[i]]++;
  }
  
  //rep(i, n)cout << s[i + 1] << " ";cout << endl;
  
  ll sum = 0;
  for(int i = 1; i <= n; i++){
    sum += (s[i] * (s[i] - 1)) / 2;
  }
  //cout << sum << endl;
  
  for(int i = 1; i <= n; i++){
    ll res = sum;
    res -= s[a[i - 1]] - 1;
    cout << res << endl;
  }
  
  return 0;
}


Compiler output:
a.cc:38:4: error: redefinition of 'll n'
   38 | ll n, a[202020], s[202020];
      |    ^
a.cc:7:4: note: 'll n' previously declared here
    7 | ll n, a[202020], s[202020];
      |    ^
a.cc:38:7: error: redefinition of 'll a [202020]'
   38 | ll n, a[202020], s[202020];
      |       ^
a.cc:7:7: note: 'll a [202020]' previously declared here
    7 | ll n, a[202020], s[202020];
      |       ^
a.cc:38:18: error: redefinition of 'll s [202020]'
   38 | ll n, a[202020], s[202020];
      |                  ^
a.cc:7:18: note: 'll s [202020]' previously declared here
    7 | ll n, a[202020], s[202020];
      |                  ^
a.cc:40:5: error: redefinition of 'int main()'
   40 | int main(){
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main(){
      |     ^~~~
Language: C++

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

int combi(int n, int k) {
  if (n == k || k == 0){
    return 1;
  }else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

int main(){
  map<int,int> mball;
  map<int,int> reball;
  int N,a,sum=0;
  int 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,2);
        	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()) {
      if(itr->second != 2){
        bcombi = reball[itr->second]
      	acombi = combi((itr->second - 1),2);
      }else if(itr->second == 2){
      	bcombi = 1;
      }
    }
    cout << sum + acombi - bcombi<< endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:37: error: expected ';' before 'acombi'
   37 |         bcombi = reball[itr->second]
      |                                     ^
      |                                     ;
   38 |         acombi = combi((itr->second - 1),2);
      |         ~~~~~~
Language: C

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


int main(){
    int N;
    int A[200001];
    int cnt[200001];
    int tbl[200001];
    int sum=0;

    scanf("%d",&N);
    for(int i = 1 ; i <= N ; i++){
      cnt[i] = 0;
      tbl[i] = 0;
    }
    for(int i = 1 ; i <=  N ; i++){
      scanf("%d",&A[i]);
      cnt[A[i]]++;
    }
    for(int i = 1 ; i <= N ; i++){
      tbl[i] = cnt[i] * (cnt[i] - 1 ) / 2;
      sum += tbl[i];
    }
    for(int i = 1 ; i <= N ; i++){
      if(cnt[A[i] != 0){
          printf("%d\n", sum - cnt[A[i]] + 1);
        }else{
          printf("%d\n", sum);
        }
    }
    return 0;
}



Compiler output:
main.c: In function 'main':
main.c:28:23: error: expected ']' before ')' token
   28 |       if(cnt[A[i] != 0){
      |                       ^
      |                       ]
Language: Java

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

/*
説明
*/
public class Main {
    public static void main(String[] args){

        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[] = new int[n];

        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            a[i] = s.nextInt();

            if (map.containsKey(a[i])) {
                map.put(a[i], 0);
            } else {
                map.put(a[i], map.get(a[i])+1);
            }
        }

        int all = 0;
        // 全通りを求める
        for (int key :map.keySet()) {
            all += map.get(key) * (map.get(key) - 1) / 2);
        }

        for (int i = 0; i < n; i++) {
            int tmp = map.get(a[i]);
            System.out.println(all - (tmp - 1));
        }
    }
}

Compiler output:
Main.java:28: error: ';' expected
            all += map.get(key) * (map.get(key) - 1) / 2);
                                                        ^
1 error
Language: C++

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


int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
     for(auto &x:A)cin>>x;
    map<int, lint> cnt;
    for (auto x : A) cnt[x]++;
    lint ret = 0;
    for (auto p : cnt) ret += (p.second - 1) * p.second / 2;
     for(int i=0;i<n;i++) {
        lint n = cnt[A[i]];
        lint tmp = ret - n+1;
        cout << tmp << "\n";
    }
}


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

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


int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
     for(auto &x:A)cin>>x;
    map<int, lint> cnt;
    for (auto x : A) cnt[x]++;
    lint ret = 0;
    for (auto p : cnt) ret += (p.second - 1) * p.second / 2;
    REP(i, N) {
        lint n = cnt[A[i]];
        lint tmp = ret - n+1;
        cout << tmp << "\n";
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'i' was not declared in this scope
   16 |     REP(i, N) {
      |         ^
a.cc:16:5: error: 'REP' was not declared in this scope
   16 |     REP(i, N) {
      |     ^~~
Language: C++

#include <iostream>
#include <map>

using namespace std;
int summ(int n);

int main() {
    map<int,int> myMap;
    map<int,int>::iterator it;
    int t;
    cin>>t;
    int tab[t];
    for(int i=0;i<t;i++){
        cin>>tab[i];
        it=myMap.find(tab[i]);
        if(it!=myMap.end()){
            it->second++;
        }else{
            myMap.insert(pair<int,int>(tab[i],1));
        }
    }
    for(int i=0;i<t;i++){
        long long int s=0;
        it=myMap.find(tab[i]);
        if(it->second>1){
            for(auto i:myMap){
                if(i.first!=it->first){
                    s+=summ(i.second-1);
                }
                else{
                    s+=summ(i.second-2);
                }
            }
        }
        cout<<s<<endl;
    }
    
}
long long int summ(int n){
    long long int res;
    if(n<1)
    return 0;
    else    
    res=1;
    for(int i=n;i>1;i--)
    res+=i;
    return res;
}

Compiler output:
a.cc:39:15: error: ambiguating new declaration of 'long long int summ(int)'
   39 | long long int summ(int n){
      |               ^~~~
a.cc:5:5: note: old declaration 'int summ(int)'
    5 | int summ(int n);
      |     ^~~~
Language: C++

int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    vector<int> a(2*100000,0);
    for (int i=0;i<N;i++){
        cin>>A.at(i);
        a.at(A.at(i))++;
    }
    int sum=0;
    for(int i=0;i<2*100001;i++){
        sum+=(a.at(i)*(a.at(i)-1))/2;
    }
    for(int k=0;k<N;k++){
        int d=a.at(A.at(k))-1;
        cout<<sum-d<<endl;
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin>>N;
      |     ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<int> A(N);
      |     ^~~~~~
a.cc:4:12: error: expected primary-expression before 'int'
    4 |     vector<int> A(N);
      |            ^~~
a.cc:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> a(2*100000,0);
      |            ^~~
a.cc:7:14: error: 'A' was not declared in this scope
    7 |         cin>>A.at(i);
      |              ^
a.cc:8:9: error: 'a' was not declared in this scope
    8 |         a.at(A.at(i))++;
      |         ^
a.cc:12:15: error: 'a' was not declared in this scope
   12 |         sum+=(a.at(i)*(a.at(i)-1))/2;
      |               ^
a.cc:15:15: error: 'a' was not declared in this scope
   15 |         int d=a.at(A.at(k))-1;
      |               ^
a.cc:15:20: error: 'A' was not declared in this scope
   15 |         int d=a.at(A.at(k))-1;
      |                    ^
a.cc:16:9: error: 'cout' was not declared in this scope
   16 |         cout<<sum-d<<endl;
      |         ^~~~
a.cc:16:22: error: 'endl' was not declared in this scope
   16 |         cout<<sum-d<<endl;
      |                      ^~~~
Language: C++

#include <iostream>

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

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

  int a[n];
  int v[2000001];
  rep(i, n) {
    v[i] = 0;
  }

  rep(i, n) {
    cin >> a[i];
    v[a[i] - 1]++;
  }

  ll total = 0;
  rep(i, n) {
    total += v[i] * (v[i] - 1) / 2;
  }


  rep(i, n) {
    ll tmp = v[a[i] - 1]  - 1;
    cout << total - tmp << endl;;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: 'll' was not declared in this scope
   21 |   ll total = 0;
      |   ^~
a.cc:23:5: error: 'total' was not declared in this scope
   23 |     total += v[i] * (v[i] - 1) / 2;
      |     ^~~~~
a.cc:28:7: error: expected ';' before 'tmp'
   28 |     ll tmp = v[a[i] - 1]  - 1;
      |       ^~~~
      |       ;
a.cc:29:13: error: 'total' was not declared in this scope
   29 |     cout << total - tmp << endl;;
      |             ^~~~~
a.cc:29:21: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   29 |     cout << total - tmp << endl;;
      |                     ^~~
      |                     tm
Language: C++

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

using namespace std;

int i,j,k;

int main(){
    int n;
    cin >>n;
    int a[n];
    int b[n+1][2];
    REP(i,n){
        b[i][0]=b[i][1]=0;
    }
    REP(i,n){
        cin>>a[i];
        REP(j,n){
            if(b[j][0]==0){
                b[j][0]=a[i];
                b[j][1]++;
                break;
            }
            else if(a[i]==b[j][0]){
                b[j][1]++;
                break;
            }
        }
    }
    int ansum=0;
    REP(i,n){
        if(b[i][0]==0){
            break;
        }
        ansum+=b[i][1]*(b[i][1]-1)/2;
    }
    REP(i,n){
        int ans;
        REP(j,n){
            if(b[j][0]==a[i]){
                ans=ansum-b[j][1]+1;
                break;
            }
        }
        
        cout<<ans<<endl;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:47:6: error: expected '}' at end of input
   47 |     }
      |      ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^