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

#include <bits/stdc++.h>
using namespace std;
int main(){
  cin >> N;
  vector<int> A(N);
  vector<int> number(N);
  for (int i == 0; i< N; i ++){
    cin >> A[i];
  }
  int total = 0;
  for (int j = 0; j < N; j ++){
    int tmp = A[j];
    numver[tmp-1] += 1;
  }
  for (int i = 0; i < N; i ++){
    total += number[i] * (number[i] - 1) /2;
  }
  for (int k = 0; k < N; k ++){
    cout << (total - number[A[j] - 1] + 1) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:10: error: 'N' was not declared in this scope
    4 |   cin >> N;
      |          ^
a.cc:7:13: error: expected ';' before '==' token
    7 |   for (int i == 0; i< N; i ++){
      |             ^~~
      |             ;
a.cc:7:14: error: expected primary-expression before '==' token
    7 |   for (int i == 0; i< N; i ++){
      |              ^~
a.cc:7:24: error: expected ')' before ';' token
    7 |   for (int i == 0; i< N; i ++){
      |       ~                ^
      |                        )
a.cc:7:26: error: 'i' was not declared in this scope
    7 |   for (int i == 0; i< N; i ++){
      |                          ^
a.cc:13:5: error: 'numver' was not declared in this scope; did you mean 'number'?
   13 |     numver[tmp-1] += 1;
      |     ^~~~~~
      |     number
a.cc:19:31: error: 'j' was not declared in this scope
   19 |     cout << (total - number[A[j] - 1] + 1) << endl;
      |                               ^
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:8:5: error: 'c' undeclared (first use in this function)
    8 |     c[i]=0;
      |     ^
main.c:8:5: note: each undeclared identifier is reported only once for each function it appears in
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 choose(ll n) {
  return n*(n-1)/2;
}

int main() {
  int n; cin >> n;
  map<int,int> mp;
  vector<int>a(n);
  rep(i,n) {
    cin >> a[i];
  }
  
  rep(i,n) {
    mp[a[i]]++;
  }
  
  
  ll total = 0;
  rep(i,n) {
    total += choose(mp[i]);
  }
  
  
  
  rep(i,n) {
    ll ans total;
    ans -= choose(mp[a[i]]);
    ans += choose(mp[a[i]]-1);
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:12: error: expected initializer before 'total'
   32 |     ll ans total;
      |            ^~~~~
a.cc:33:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |     ans -= choose(mp[a[i]]);
      |     ^~~
      |     abs
Language: C++

#include<iostream>
#include<vector>
using namespace std;
using int = long long;
int main(void){
    int n;
    int NUM[200001]={};
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
        NUM[a[i]]++;
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
        if(NUM[i]>=2)
            ans += NUM[i]*(NUM[i]-1)/2;
    }
    for(int i=0;i<n;i++){
        if(NUM[a[i]]>=2)
            cout << ans - (NUM[a[i]]*(NUM[a[i]]-1)/2-(NUM[a[i]]-1)*(NUM[a[i]]-2)/2) << endl;
        else 
            cout << ans << endl;
    }
    return 0;
} 

Compiler output:
a.cc:4:7: error: expected nested-name-specifier before 'int'
    4 | using int = long long;
      |       ^~~
Language: Java

import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        long[] count = new long[N+1]; //その数値がいくつあるか
        long sum = 0;

        //入力
        for(int i=0; i<N; i++) {
            A[i] = sc.nextInt();
            count[A[i]]++;
        }

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

        //count[A[i] + 1] は n-1C2 - nC2の差分を計算した
        for(int i=0; i<N; i++) {
            System.out.println(sum - count[A[i]] + 1);
        }

	}
	public static int comb2(long num){
        int ans = (num * (num - 1)) / 2;
		return ans;
    }
}

Compiler output:
Main.java:28: error: incompatible types: possible lossy conversion from long to int
        int ans = (num * (num - 1)) / 2;
                                    ^
1 error
Language: Java

import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        long[] count = new long[N+1]; //その数値がいくつあるか
        long sum = 0;

        //入力
        for(int i=0; i<N; i++) {
            A[i] = sc.nextInt();
            count[A[i]]++;
        }

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

        //count[A[i] + 1] は n-1C2 - nC2の差分を計算した
        for(int i=0; i<N; i++) {
            System.out.println(sum - count[A[i]] + 1);
        }

	}
	public static int comb2(int num){
        int ans = (num * (num - 1)) / 2;
		return ans;
    }
}

Compiler output:
Main.java:18: error: incompatible types: possible lossy conversion from long to int
            sum += comb2(count[i]);
                              ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

import Control.Monad
import Data.List

gr = map (\x-> (head x, x)) . group . sort

cmb ln = flip div 2 $ product $ take 2 $ iterate (subtract 1) ln

total :: [(Int, [Int])] -> Int
total xs = sum $ map (cmb . length . snd) xs

solve xs = map (p . e) xs
  where
    g = gr xs
    t = total g
    e = flip lookup g
    p (Just ss) = t - (length ss - 1)

main = do
  n <- readLn :: IO Int
  xs <- (map read . words) <$> getLine
  putStr $ unlines $ map show (solve xs )


Compiler output:
a.cc:4:11: error: stray '\' in program
    4 | gr = map (\x-> (head x, x)) . group . sort
      |           ^
a.cc:1:1: error: 'import' does not name a type
    1 | import Control.Monad
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C

#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
const int MAXN = (int)((1e5) + 100);
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;} 
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 
signed main(){
  fio;
    int n;
    cin>>n;
    vector<int> arr(n);
    for0(i,n) cin>>arr[i];
    map<int,int>cnt;
    for(auto x : arr){
      cnt[x]++;
    }
    int ret = 0;
    for(auto p : cnt) ret += (p.second -1) * p.second/2;
    for0(i,n){
      int N = cnt[arr[i]];
      int tmp = ret - (N-1)*N/2 + (N-2)*(N-1)/2;
      cout<<tmp<<"\n";
    }
  rr;
}



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

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n
}#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
  int n;
  cin>>n;
  
  vector<int> v(n);
  map<int,int> m;
  map<int,int>::iterator it;
  
  for(int i=0;i<n;i++)
  {
   cin>>v[i];
   m[v[i]]++;
  }
  
  for(int i=0;i<n;i++)
  {
  	long long count=0;
  	for(it=m.begin();it!=m.end();it++)
  	{
  	 if(it->first==v[i])
  	 {
  	 	count+=(it->second -1)*(it->second -2)/2;
	 }
	 else count+=(it->second)*(it->second -1)/2;
	  }
  	
  	cout<<count<<"\n";
  }
  
  return 0;
}
  

Compiler output:
a.cc:6:2: error: stray '#' in program
    6 | }#include<bits/stdc++.h>
      |  ^
a.cc: In function 'int main()':
a.cc:6:1: error: expected initializer before '}' token
    6 | }#include<bits/stdc++.h>
      | ^
a.cc: At global scope:
a.cc:6:3: error: 'include' does not name a type
    6 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:8:5: error: redefinition of 'int main()'
    8 | int main()
      |     ^~~~
a.cc:3:5: note: 'int main()' previously defined here
    3 | int main()
      |     ^~~~
Language: C++

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

#define int long long

int main(){
    int n;
    cin >>n;
    int a[n+1];
    int b[n+1];
    for(int i=1;i<=n;i++){
        cin >> a[i];
        b[i]=0;
    }
    for(int i=1;i<=n;i++){
        b[a[i]]++ ;
    }
    int max=0;
    for(int i=1;i<=n;i++){
        max += b[i]*(b[i]-1)/2;
    }
    for(int i=1;i<=n;i++){
        cout << max - (b[a[i]] - 1) << endl;
    }
    return 0;
}

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

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

#define int long long

int main(){
    int n;
    cin >>n;
    int a[n+1];
    int b[n+1];
    for(int i=1;i<=n;i++){
        cin >> a[i];
        b[i]=0;
    }
    for(int i=1;i<=n;i++){
        b[a[i]]++ ;
    }
    int max=0;
    for(int i=1;i<=n;i++){
        max += b[i]*(b[i]-1)/2;
    }
    for(int i=1;i<=n;i++){
        cout << max - (b[a[k]] - 1) << endl;
    }
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:23:28: error: 'k' was not declared in this scope
   23 |         cout << max - (b[a[k]] - 1) << endl;
      |                            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n;
  cin >> n;
  map<int , int> m;
  int a[n];
  for(int i = 0 ; i < n ; i++){
    cin >> a[i];
    m[a[i]]++;
  }
  
  ll sum = 0;
  for(auto it : m){
    sum += (1ll * it.ss * (it.ss - 1)) / 2;
  }
  
  for(int i = 0 ; i < n ; i++){
    int num = m[a[i]];
    ll sum1 = sum;
    if(num > 1){
      sum -= (1ll * num * (num - 1)) / 2;
      sum += (1ll * (num - 1) * (num - 1)) / 2;
    }
    cout << sum << endl;
    sum = sum1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:22: error: 'struct std::pair<const int, int>' has no member named 'ss'
   17 |     sum += (1ll * it.ss * (it.ss - 1)) / 2;
      |                      ^~
a.cc:17:31: error: 'struct std::pair<const int, int>' has no member named 'ss'
   17 |     sum += (1ll * it.ss * (it.ss - 1)) / 2;
      |                               ^~
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
ll nchoose2(int n){
  return n*(n-1)/2;
}
int main()	{
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n) cin>>a[i];
  vector<int>d(n);
  int sum=0;
  rep(i,n)
    d[a[i]]++;
  rep(i,n){
    sum+=nchoose2(d[i]);
  }
  rep(i,n){
    ll ans=sum;
    ans-=nchoose2(d[a[i]]);
    d[a[i]]--;
    ans+=nchoose2(d[a[i]]);
    cout<<ans<<endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
ll nchoose2(int n){
  return n*(n-1)/2;
}
int main()	{
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n) cin>>a[i];
  vector<int>d(n);
  int sum=0;
  rep(i,n)
    d[a[i]]++;
  rep(i,n){
    sum+=nchoose2(d[i]);
  }
  rep(i,n){
    ll ans=sum;
    ans-=nchoose2(d[a[i]]);
    d[a[i]]--;
    ans+=nchoose2(d[a[i]]);
  }
  cout<<ans<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |   cout<<ans<<endl;
      |         ^~~
      |         abs
a.cc:29:19: error: expected '}' at end of input
   29 |   cout<<ans<<endl;
      |                   ^
a.cc:11:17: note: to match this '{'
   11 | int main()      {
      |                 ^
Language: C++

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

li choose2(li 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]]++;
    li tot = 0;
    rep(i, n) {
        tot += choose2(cnt[i]);
    }
    rep(i, n) {
        li ans = tot;
        ans -= choose2(cnt[a[i]]);
        ans += choose2(cnt[a[i]] - 1);
        cout << ans << endl
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:28: error: expected ';' before '}' token
   27 |         cout << ans << endl
      |                            ^
      |                            ;
   28 |     }
      |     ~
Language: C++

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

li choose2(li 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]]++;
    li tot = 0;
    rep(i, n) {
        tot += choose2(cnt[i]);
    }
    rep(i, n) {
        li ans = tot;
        ans -= choose2(cnt[a[i]]);
        ans += choose2(cnt[a[i]] - 1);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'i' was not declared in this scope
   15 |     rep(i, n) cin >> a[i];
      |                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long a[200001], sum[200001], n, x, ans;
double s;
int main()
{
	scanf("%d", &n);
	for (register long long i=1; i<=n; ++i)
	{
		scanf("%d", &a[i]);
		++sum[a[i]];
	}
	for (register long long i=1; i<=n; ++i)
		if (sum[a[i]]>=2) s+=(sum[a[i]]-1)*1.0/2;
	x=long long(s); 
	for (register long long i=1; i<=n; ++i)
	{
		ans=x-(sum[a[i]])*(sum[a[i]]-1)/2;
		ans+=(sum[a[i]]-1)*(sum[a[i]]-2)/2;
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:33: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    8 |         for (register long long i=1; i<=n; ++i)
      |                                 ^
a.cc:13:33: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 |         for (register long long i=1; i<=n; ++i)
      |                                 ^
a.cc:15:11: error: expected primary-expression before 'long'
   15 |         x=long long(s);
      |           ^~~~
a.cc:16:33: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   16 |         for (register long long i=1; i<=n; ++i)
      |                                 ^
Language: C

def f(n):
  return (n*(n-1))//2
N=int(input())
A=list(map(int,input().split()))
d=dict()
ans=0
#それぞれが何個あるかを辞書に登録
for i in range(len(A)):
  if A[i] not in d:
    d[A[i]]=0
  d[A[i]]+=1
for i in d:
  ans+=f(d[i])
for i in range(len(A)):
  print(ans-d[A[i]]+1)

Compiler output:
main.c:1:1: error: unknown type name 'def'
    1 | def f(n):
      | ^~~
main.c: In function 'f':
main.c:1:9: error: expected declaration specifiers before ':' token
    1 | def f(n):
      |         ^
main.c:7:2: error: invalid preprocessing directive #\U0000305d\U0000308c\U0000305e\U0000308c\U0000304c\U00004f55\U0000500b\U00003042\U0000308b\U0000304b\U00003092\U00008f9e\U000066f8\U0000306b\U0000767b\U00009332
    7 | #それぞれが何個あるかを辞書に登録
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:1:5: error: type of 'n' defaults to 'int' [-Wimplicit-int]
    1 | def f(n):
      |     ^
Language: C++

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

int main(){
  int x;
  cin>>x;
  vector<int>y(x);
  for(int i=0;i<x;i++){
  cin>>y.at(i);
  }
  //jは取り出す、kは調べる、lは相手
  for(int j=0;j<x-1;j++){
    int sum=0;
  for(int k=0;k<x;k++){
  if (j!=k){
  for(int l=0;l<x;l++){
  if(j!=l&&k!=l&&y.at(k)==y.at(l)){
  sum+=1
  }
  }
  }
  }
  cout<<sum/2<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: expected ';' before '}' token
   18 |   sum+=1
      |         ^
      |         ;
   19 |   }
      |   ~
Language: C++

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

int main(){
  int x;
  cin>>x;
  vector<int>y(x);
  for(int i=0;i<x;i++){
  cin>>y.at(i);
  }
  //jは取り出す、kは調べる、lは相手
  for(int j=0;j<x-1;j++){
    int sum=0;
  for(int k=0;k<x;k++){
  if (j!=k){
  for(int l=0;l<x;l++){
  if(j!=l&&k!=l&&y.at(k)==y.at(l)){
  sum+=1
  }
  }
  }
  }
  cout<<sum<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: expected ';' before '}' token
   18 |   sum+=1
      |         ^
      |         ;
   19 |   }
      |   ~
Language: C

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

int cmpnum(const void * n1, const void * n2)
{
	if (*(long *)n1 > *(long *)n2)
	{
		return -1;
	}
	else if (*(long *)n1 < *(long *)n2)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

 
int main(){
  long long N, ans=0;
  long long A[200000];
  long long B[200000];

  scanf("%lld",&N);

  for (int i = 0; i < N; i++)
  {
      scanf("%lld", A[i]);
      B[i] = 0;
      
  }
  for (int i = 0; i < N; i++)
  {
      B[A[i]-1] += 1;
  }

  for (int i = 0; i < N; i++)
  {
      ans += (B[i]-1) * (B[i]) /2;
  }
    
  for (int k = 0; k < N; k++)
  {
      printf("%lld ", ans - ((B[k]-1) * (B[k]) /2)) + ((B[k]-1) * (B[k]-2) /2)));
  }
  

//   printf("%lf", (double)(L*L*L)/27);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:47:79: error: expected ';' before ')' token
   47 |       printf("%lld ", ans - ((B[k]-1) * (B[k]) /2)) + ((B[k]-1) * (B[k]-2) /2)));
      |                                                                               ^
      |                                                                               ;
main.c:47:79: error: expected statement before ')' token
main.c:47:80: error: expected statement before ')' token
   47 |       printf("%lld ", ans - ((B[k]-1) * (B[k]) /2)) + ((B[k]-1) * (B[k]-2) /2)));
      |                                                                                ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: 'j' was not declared in this scope
   11 |   for(j=0;j<x-1;j++){
      |       ^
a.cc:13:7: error: 'k' was not declared in this scope
   13 |   for(k=j+1;k<x;k++){
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main()	{
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n) cin>>a[i];
  int sum1=n(n-1)/2;
  int sum2=0;
  rep(i,n){
    int count=0;
    rep(j,n){
      if(i==j)
        continue;
      else if(a[i]==a[j])
        count++;
    }
    sum2+=count(count-1)/2;
  }
  int ans=sum1-sum2;
  cout<<ans<<endl;
      
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'n' cannot be used as a function
   13 |   int sum1=n(n-1)/2;
      |            ~^~~~~
a.cc:23:16: error: 'count' cannot be used as a function
   23 |     sum2+=count(count-1)/2;
      |           ~~~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int MAXN=200005;
int n,tot,ans,i;
int a[MAXN],c[MAXN];

int main(){
	cin>>n;
		
    for(i=1;i<=n;i++){
		cin>>a[i];
		c[a[i]]++;
	}
		
    for(i=1;i<=n;i++)
    ans+=(ll)c[i]*(c[i]-1)/2;
        
    for(i=1;i<=n;i++)
    cout<<ans-(ll)(c[a[i]]-1)<<endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: 'll' was not declared in this scope
   16 |     ans+=(ll)c[i]*(c[i]-1)/2;
      |           ^~
a.cc:19:16: error: 'll' was not declared in this scope
   19 |     cout<<ans-(ll)(c[a[i]]-1)<<endl;
      |                ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n;cin>>n;
  ll v[n];
  memset(v,0,sizeof(v));
  ll maximo=0;
  for(int i=1;i<=n;i++){
    cin>>v[i];
    maximo=max(maximo,v[i]);
  }
  ll ocu[maximo+10];
  memset(ocu,0,sizeof(ocu));
  for(int i=1;i<=n;i++){
    ocu[v[i]]++;
  }
  ll ans=0;
  for(int i=1;i<=n;i++){
    ans+=cu[i]*(ocu[i]-1)/2;
  }
  for(int i=1;i<=n;i++){
    cout<<ans-(ocu[v[i]]-1)<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: 'cu' was not declared in this scope; did you mean 'ocu'?
   20 |     ans+=cu[i]*(ocu[i]-1)/2;
      |          ^~
      |          ocu
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long int
 
int32_t main(){
 
	unordered_map <int, int> m;
	unordered_map <int, int>:: iterator itr;
	int n, i,sum = 0;
	cin >> n;
	vector<int> v(n);
 
	for(i=0; i<n; i++){
 
		cin >> v[i];
		itr  = m.find(v[i]);
		if(itr == m.end())
			m.insert({v[i], 1});
		else
			itr->second++;
	}
 
	for(itr = m.begin(); itr != m.end(); itr++){
		if(itr->second > 1)
			sum += itr->second * (itr->second - 1) / 2;
	}
 
	for( i=0; i<n; i++){
 
		itr = m.find(v[i]);
 
		if(itr->second > 1)
			cout<< sum - (itr->second - 1) ;
		else
			cout<<sum;
		cout<<endl;
	}
 
	return 0;
}
#include <bits/stdc++.h>

using namespace std;

#define int long long int

int32_t main(){

	unordered_map <int, int> m;
	unordered_map <int, int>:: iterator itr;
	int n, i,sum = 0;
	cin >> n;
	vector<int> v(n);

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

		cin >> v[i];
		itr  = m.find(v[i]);
		if(itr == m.end())
			m.insert({v[i], 1});
		else
			itr->second++;
	}

	for(itr = m.begin(); itr != m.end(); itr++){
		if(itr->second > 1)
			sum += itr->second * (itr->second - 1) / 2;
	}

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

		itr = m.find(v[i]);

		if(itr->second > 1)
			cout<< sum - (itr->second - 1) ;
		else
			cout<<sum;
		cout<<endl;
	}

	return 0;
}

Compiler output:
a.cc:49:9: error: redefinition of 'int32_t main()'
   49 | int32_t main(){
      |         ^~~~
a.cc:7:9: note: 'int32_t main()' previously defined here
    7 | int32_t main(){
      |         ^~~~
Language: Java

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

public class D {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] ar = new int[n];
        Map<Integer,Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            ar[i] = scan.nextInt();
            map.put(ar[i],map.getOrDefault(ar[i],0)+1);
        }

        long sumAll = 0;
        for(Map.Entry<Integer,Integer> e : map.entrySet()){
            long value = (long)e.getValue();
            sumAll+= (value*(value-1))/2;
        }

        for (int i = 0; i < n; i++) {
            long sol = 0;
            long v = (long)map.get(ar[i]);
            long t = (v*(v-1))/2;
            long p = ((v-1)*(v-2))/2;
            sol= sumAll - t + p;
            System.out.println(sol);
        }
    }
}

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

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

int main(){
    int n,a,now;
    cin >> n;
    
    vector<int> A,sortedA;
    vector<int> stcount(200000,0);
    rep(i,n){ 
        cin >> a;
        A.push_back(a);
    }
    sortedA = A;
    sort(sortedA.begin(),sortedA.end());
    
    long long count=0;
    long long sum=0;
    long long ans;
    now = sortedA.at(0);
    rep(i,n){
        if (now == sortedA.at(i)){
            count++;
        }else{
           sum += count*(count-1)/2;
           stcount.at(now) = count;
           now = sortedA.at(i);
           count=1;
        }
    }
    sum += count*(count-1)/2;
    stcount.at(now) = count;

    rep(i,n){
        b = stcount.at(A.at(i));
        if (b!=0){
            ans = sum - b + 1;
        }else{
            ans = sum;
        }
        cout << ans << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'b' was not declared in this scope
   36 |         b = stcount.at(A.at(i));
      |         ^
Language: C++

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

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

int main() {
    int n; cin >> n;
    vector<int> a(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }
    vector<int> cnt(n, 0);
    for (int i = 0; i < n; i++) {
        cnt[a[i]]++;
    }
    long long total = 0;
    for (int i = 0; i < n; i++) {
        total += nC2(cnt[i]);
    }
    for (int i = 0; i < n; i++) {
        long long ans = total;
        ans -= nC2(cnt[a[i]]);
        cnt[a[i]]--;
        ans += nC2(ccnt[a[i]]);
        cout << ans << endl;
        cnt[a[i]]++;
    }
    return 0;
}

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

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
 
  map<int, int> cnt;
  for (int x : A) {
    if (cnt.count(x)) {
      // 既に含まれているならインクリメント
      cnt.at(x)++;
    } else {
      // 含まれていないなら、1を追加
      cnt[x] = 1;
    }
  }
  
  for (int i = 0; i < N; i++){
    cut<<N-cnt.at(i)<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'cut' was not declared in this scope; did you mean 'cnt'?
   24 |     cut<<N-cnt.at(i)<<endl;
      |     ^~~
      |     cnt
Language: C++

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

long long choose2(long long 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]]++;
  long long tot=0;
  rep(i,n){
  tot+=choose2(cnt[i]);
  }
  rep(i,n){
  long long ans=tot;
    ans-=choose2(cnt[a[i]]);
    ans+=choose2(cnt[a[i]]-1);
    cout<<ans<<endl;
  }
  
}

Compiler output:
a.cc:15:11: error: extended character 　 is not valid in an identifier
   15 |   rep(i,n)　a[i]--;
      |           ^
a.cc: In function 'int main()':
a.cc:15:11: error: '\U00003000a' was not declared in this scope
   15 |   rep(i,n)　a[i]--;
      |           ^~~
Language: C++

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

ll cnt[114514],a[114514];

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

	for(int i=0;i<n;i++){
		cin>>a[i];
		cnt[a[i]]++;
	}
	ll ans=0;
	for(int i=1;i<=n;i++){
		ans+=cnt[i]*(cnt[i]-1)/2;
	}8
1 2 1 4 2 1 4 1
	for(int i=0;i<n;i++){
		cout<<ans-cnt[a[i]]*(cnt[a[i]]-1)/2+(cnt[a[i]]-1)*(cnt[a[i]]-2)/2<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:11: error: expected ';' before numeric constant
   18 |         }8
      |           ^
      |           ;
   19 | 1 2 1 4 2 1 4 1
      | ~          
a.cc:20:21: error: 'i' was not declared in this scope
   20 |         for(int i=0;i<n;i++){
      |                     ^
Language: C++

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

int main() {
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector <int> A(n,0);
    vector <int> B(n+1,0);
    for(int i=0;i<n;i++){
        cin >> A[i];
        B[A[i]]++;
    }
    int sum=0;
    for(int i=0;i<n+1;i++){
        sum+=(B[i]*(B[i]-1))/2;
    }
    vector<int> C(n,0);
    for(int i=0;i<n;i++){
        C[i]=sum-B[A[i]]*(B[A[i]]-1)/2+(B[A[i]]-1)*(B[A[i]]-2)/2;
        cout << C[i] << endl;
    }
    return 0;
}

//    sort(A, A + N, greater<int>()); 降順

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

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;


int main() {

    int N;
    cin >> N;

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

    int sum = 0;
    for (int i = 0; i < N; ++i) {
        sum += (B[i]*(B[i]-1))/2;
    }
    vector<int> C(N,0);
    for (int i = 0; i < N; ++i) {
        C[i] = sum - B[A[i]] * (B[A[i]]-1) / 2 + (B[A[i]]-1)*(B[A[i]]-2)/2;
        cout << C[i] << endl;
    }
    return 0;
}

//    sort(A, A + N, greater<int>()); 降順

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'vector' was not declared in this scope
   13 |     vector <int> A(N,0);
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | 
a.cc:13:13: error: expected primary-expression before 'int'
   13 |     vector <int> A(N,0);
      |             ^~~
a.cc:14:13: error: expected primary-expression before 'int'
   14 |     vector <int> B(N+1,0);
      |             ^~~
a.cc:16:16: error: 'A' was not declared in this scope
   16 |         cin >> A[i];
      |                ^
a.cc:17:9: error: 'B' was not declared in this scope
   17 |         B[A[i]]++;
      |         ^
a.cc:22:17: error: 'B' was not declared in this scope
   22 |         sum += (B[i]*(B[i]-1))/2;
      |                 ^
a.cc:24:12: error: expected primary-expression before 'int'
   24 |     vector<int> C(N,0);
      |            ^~~
a.cc:26:9: error: 'C' was not declared in this scope
   26 |         C[i] = sum - B[A[i]] * (B[A[i]]-1) / 2 + (B[A[i]]-1)*(B[A[i]]-2)/2;
      |         ^
a.cc:26:22: error: 'B' was not declared in this scope
   26 |         C[i] = sum - B[A[i]] * (B[A[i]]-1) / 2 + (B[A[i]]-1)*(B[A[i]]-2)/2;
      |                      ^
a.cc:26:24: error: 'A' was not declared in this scope
   26 |         C[i] = sum - B[A[i]] * (B[A[i]]-1) / 2 + (B[A[i]]-1)*(B[A[i]]-2)/2;
      |                        ^
Language: Java

import java.util.*;
import java.lang.*;
public class Solution{
	
	
	public static final Scanner in =  new Scanner(System.in);
	public static void main(String args []){
		int n =in.nextInt();
		ArrayList m = new ArrayList();
		for(int i=0;i<n;i++){
			m.add(in.nextInt());	
		}
		
		for(int i=0;i<m.size();i++){
			int c = (int) m.get(i);
			m.remove(i);
			int count=0;
			int a = m.size();
			for(int j=0;j<a-1;j++){
				for(int k=j+1;k<a;k++){
					if((int) m.get(j)==(int) m.get(k)){
						count++;
					}
				}
			}
			m.add(i,c);
			System.out.println(count);
		}
		
	}
}


Compiler output:
Main.java:3: error: class Solution is public, should be declared in a file named Solution.java
public class Solution{
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

using namespace std;
int main() {
    
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            while(j!=i){
                cin >> b[j];
            }
        }
        int ans=0;
        sort(b.begin(),b.end());
        for(int j=0;j<n-1;j++){
            for(int k=j;k<n-2;k++){
                ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> n;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector<int> a(n), b(n);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:6:12: error: expected primary-expression before 'int'
    6 |     vector<int> a(n), b(n);
      |            ^~~
a.cc:8:16: error: 'a' was not declared in this scope
    8 |         cin >> a[i];
      |                ^
a.cc:13:24: error: 'b' was not declared in this scope
   13 |                 cin >> b[j];
      |                        ^
a.cc:17:14: error: 'b' was not declared in this scope
   17 |         sort(b.begin(),b.end());
      |              ^
a.cc:17:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |         sort(b.begin(),b.end());
      |         ^~~~
      |         short
a.cc:23:9: error: 'cout' was not declared in this scope
   23 |         cout << ans << endl;
      |         ^~~~
a.cc:23:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:24: error: 'endl' was not declared in this scope
   23 |         cout << ans << endl;
      |                        ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

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

int main()
{
    ll N;
    cin >> N;
    vector<ll> a(N);
    rep(i, N)
    {
        cin >> a.at(i);
    }
    vector<ll> b(N, 0);
    rep(i, N)
    {
        b.at(a.at(i) - 1)++;
    }
    ll sum = 0;
    rep(i, N)
    {
        if (b.at(i) == 0 || b.at(i) == 1)
        {
            continue;
        }
        sum += (b.at(i) * (b.at(i) - 1)) / 2;
    }
    rep(k, N)
    {
        ll sum_k = sum;
        sum_k -= b.at(a.at(k) - 1) - 1;
        cout << sum_k << endl;
        return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:38:6: error: expected '}' at end of input
   38 |     }
      |      ^
a.cc:10:1: note: to match this '{'
   10 | {
      | ^
Language: C++

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

int main()
{
    ll N;
    cin >> N;
    vector<ll> a(N);
    rep(i, N)
    {
        cin >> a.at(i);
    }
    vector<ll> b(N, 0);
    rep(i, N)
    {
        b.at(a.at(i) - 1)++;
    }
    ll sum = 0;
    rep(i, N)
    {
        if (b.at(i) == 0 || b.at(i) == 1)
        {
            continue;
        }
        sum += (b.at(i) * (b.at(i) - 1)) / 2;
    }
    rep(k, N)
    {
        ll sum_k = sum;
        sum_k -= b.at(a.at(k) - 1) - 1;
        cout << sum_k << endl;
        return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:38:6: error: expected '}' at end of input
   38 |     }
      |      ^
a.cc:10:1: note: to match this '{'
   10 | {
      | ^
Language: C++

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

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N), cnt(N + 1);
  for (int i = 0, a; cin >> a; i++) A.at(i) = a, cnt.at(a)++;

  long sum = 0;
  for (int i : cnt) sum += c2(c);

  for (int a : A) cout << sum - c2(cnt.at(a) + c2(cnt.at(a - 1))) << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:31: error: 'c' was not declared in this scope
   15 |   for (int i : cnt) sum += c2(c);
      |                               ^
Language: C++

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


int main() {
 #define int long long
  int N;
  cin >> N;
  vector<int> A(N),B(N);
  int a,sum;
  for(int i=0;i<N;i++){
    cin >> a;
    A[i]=a;
    B[a]++;
  }
  for(int j=0;j<N;j++){
    sum+=(B[j]*(B[j]-1)*0.5);
  }
  int ans;
  for(int i=0;i<N;i++){
    ans=0;
    ans=sum - (B[j]*(B[j]-1)*0.5);
    B[A[i]]--;
    ans+=(B[j]*(B[j]-1)*0.5);
    cout << ans << endl;
    B[A[i]]++;
  }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: 'j' was not declared in this scope
   22 |     ans=sum - (B[j]*(B[j]-1)*0.5);
      |                  ^
Language: C++

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

long main() {
  long N, tmp, i, j;
  cin >> N;
  map<long, long> A;
  long B[N];
  for (i = 0; i < N; i++) {
    cin >> tmp;
    B[i] = tmp;
    if (A.count(tmp) == 0) {
      A[tmp] = 1;
    } else {
      A[tmp] += 1;
    }
  }

  long result = 0;
  for (auto i = A.begin(); i != A.end(); ++i) {
    result += ((i->second) * ((i->second) - 1)) / 2;
  }
  //   for (auto i = A.begin(); i != A.end(); ++i) {
  //     for (j = 0; j < i->second; j++) {
  //       cout << max(result - (i->first) - 1, 0) << endl;
  //     }
  //   }
  for (i = 0; i < N; i++) {
    cout << max(result - (A[B[i]] - 1), 0) << endl;
  }
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:30:16: error: no matching function for call to 'max(long int, int)'
   30 |     cout << max(result - (A[B[i]] - 1), 0) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
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:30:16: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   30 |     cout << max(result - (A[B[i]] - 1), 0) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:30:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   30 |     cout << max(result - (A[B[i]] - 1), 0) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

using namespace std;

long long get_nC2(long long n) {
		long long res = n * (n - 1) / 2;
		return res;
}

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

	int A[200005];
	int times[200005] = {0};
	for(int i = 0; i < N; i++){
			cin >> A[i];
			times[A[i]] += 1;
	}

	long long all = 0;
	for (int t: times) {
			all += get_nC2(t);
	}

	for (int i = 0; i < N; i++) {
			long long minus = get_nC2(times[A[i]]);
			long long plus = get_nC2(times[A[i]] - 1);
			cout << all - minus + plus << endl;
	}


}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     cin >> N;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | // #include<bits/stdc++.h>
a.cc:29:25: error: 'cout' was not declared in this scope
   29 |                         cout << all - minus + plus << endl;
      |                         ^~~~
a.cc:29:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:55: error: 'endl' was not declared in this scope
   29 |                         cout << all - minus + plus << endl;
      |                                                       ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | // #include<bits/stdc++.h>
Language: C++

#include<bits//stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n;i++)
int main() {
	ll n,sum =0;cin >> n;vector<int> a(n),c(n + 1,0);
	rep(i, n) {
		cin >> a[i];
		sum += c[a[i]];c[a[i]]++;
	}
	rep(i,n) cout << sum - c[a[i]] + 1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'll' was not declared in this scope
    5 |         ll n,sum =0;cin >> n;vector<int> a(n),c(n + 1,0);
      |         ^~
a.cc:5:28: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |         ll n,sum =0;cin >> n;vector<int> a(n),c(n + 1,0);
      |                            ^
      |                            yn
a.cc:8:17: error: 'sum' was not declared in this scope
    8 |                 sum += c[a[i]];c[a[i]]++;
      |                 ^~~
a.cc:10:26: error: 'sum' was not declared in this scope
   10 |         rep(i,n) cout << sum - c[a[i]] + 1 << endl;
      |                          ^~~
Language: C++

#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;
typedef long long ll;

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

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[a[i]]++;
 ll tot = 0;
 rep(i,n){
     tot+= choose2(cnt[i]);
 }
rep(i,n){
    ll ans = tot;
    ans -= choose2(cnt[a[i]]);
    cnt[a[i]]--;
    ans +=choose2(cnt[a[i]]);
    cout<<ans<<endl;
    cnt[a[i]]++;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:20: error: 'i' was not declared in this scope
   35 |  vector<int> cnt[a[i]]++;
      |                    ^
a.cc:35:23: error: expected initializer before '++' token
   35 |  vector<int> cnt[a[i]]++;
      |                       ^~
a.cc:38:20: error: 'cnt' was not declared in this scope; did you mean 'int'?
   38 |      tot+= choose2(cnt[i]);
      |                    ^~~
      |                    int
a.cc:42:20: error: 'cnt' was not declared in this scope; did you mean 'int'?
   42 |     ans -= choose2(cnt[a[i]]);
      |                    ^~~
      |                    int
a.cc:47:2: error: expected '}' at end of input
   47 | }
      |  ^
a.cc:29:1: note: to match this '{'
   29 | {
      | ^
Language: C++

#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

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[a[i]]++;
 ll tot = 0;
 rep(i,n){
     tot+= choose2(cnt[i]);
 }
rep(i,n){
    ll ans = tot;
    ans -= choose2(cnt[a[i]]);
    cnt[a[i]]--;
    ans +=choose2(cnt[a[i]]);
    cout<<ans<<endl;
    cnt[a[i]]++;
}
/*
 ll N;
 cin>>N;
 ll d[N];
 for(int i=0;i<N;++i)cin>>d[i];

int num[N];

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

for(int i = 0;i<N;++i)
{
 num[d[i]]++;
}

ll ans = 0;

for(int i = 0; i < N;i++){
    ans+=num[i]*(num[i]-1)/2;
}

cout<<endl;

for(int i = 0; i < N;i++){
    if(num[d[i]]>0){
    ans-=(num[d[i]]-1);
    cout<<ans<<endl;
    ans+=(num[d[i]]-1);
    }
}
*/


 return 0;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:20: error: 'i' was not declared in this scope
   34 |  vector<int> cnt[a[i]]++;
      |                    ^
a.cc:34:23: error: expected initializer before '++' token
   34 |  vector<int> cnt[a[i]]++;
      |                       ^~
a.cc:37:20: error: 'cnt' was not declared in this scope; did you mean 'int'?
   37 |      tot+= choose2(cnt[i]);
      |                    ^~~
      |                    int
a.cc:41:20: error: 'cnt' was not declared in this scope; did you mean 'int'?
   41 |     ans -= choose2(cnt[a[i]]);
      |                    ^~~
      |                    int
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#define MX 20001
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
typedef pair<int, int> P;
int a[MX], b[MX];
int main()
{
	int n;
	
	memset(b, 0, sizeof(b));
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		b[a[i]]++;
	}
	int bas = 0;
	rep(i, n) bas += b[i] * (b[i] - 1) / 2;
	rep(k, n) {
		int ans = 0;
		ans = bas - b[a[k]] + 1;
		
		cout << ans << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'memset' was not declared in this scope
   17 |         memset(b, 0, sizeof(b));
      |         ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <utility>
  +++ |+#include <cstring>
    7 | #define MX 20001