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

  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

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

bool isok(string s) {
  string p = s;
  reverse(p.begin(), p.end());
  return p == s;
}

int main() {
  double n; cin >> n;
  double ans = (n / 3.0) * (n / 3.0) * (n / 3.0);
  printf("%0.8lf\n", ans);
  return 0;
}

Compiler output:
a.cc:1:7: error: expected constructor, destructor, or type conversion before '(' token
    1 |   read(args...);
      |       ^
a.cc:2:1: error: expected declaration before '}' token
    2 | }
      | ^
a.cc: In function 'void print(T, Args ...)':
a.cc:8:3: error: 'cout' was not declared in this scope
    8 |   cout << a << " \n"[sizeof...(args) == 0];
      |   ^~~~
a.cc: At global scope:
a.cc:16:11: error: 'string' was not declared in this scope
   16 | bool isok(string s) {
      |           ^~~~~~
a.cc: In function 'int main()':
a.cc:23:13: error: 'cin' was not declared in this scope
   23 |   double n; cin >> n;
      |             ^~~
a.cc:25:3: error: 'printf' was not declared in this scope
   25 |   printf("%0.8lf\n", ans);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 |   read(args...);
Language: C++

#include <bits/stdc++.h>
using namespace 
std;int main() {
  int L;
  cin>>L;
  int l=L/3
  cout<<(l*l)*l<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'cout'
    7 |   cout<<(l*l)*l<<endl;
      |   ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long double n;
  cin >> n;
  cout << (n * n * n) / 27.0 << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:6:38: error: expected '}' at end of input
    6 |   cout << (n * n * n) / 27.0 << endl;
      |                                      ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++h>
using namespace std;
double x;
int main()
{
	cin>>x;
	cout<<x*x*x/27;
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pl;
typedef queue<ll> ql;
typedef set<ll> sl;
typedef vector<ll> vl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll &b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll &b) {if(b > a) {a = b; return 1;} return 0;}
const ll inf = 1LL << 60;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const ll max = 500010;
ll num, M, N, ans=0, count=0;
int main() {
  dl L;
  cin >> L;
  cout << (L*L*L)/27 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: 'dl' was not declared in this scope; did you mean 'vl'?
   22 |   dl L;
      |   ^~
      |   vl
a.cc:23:10: error: 'L' was not declared in this scope
   23 |   cin >> L;
      |          ^
Language: C

#include<bits/stdc++.h>
#pragma GCC optimize ("-O3")
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define int long long
#define double long double
#define pb push_back
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define diff(a,b) (a>b?a-b:b-a)
const int N=1e6+5;
void pairsort(int a[], int b[], int n){
    pair<int, int> pairt[n];
    for (int i = 0; i < n; i++) 
    {
        pairt[i].first = a[i];
        pairt[i].second = b[i];
    }
    sort(pairt, pairt + n);
    for (int i = 0; i < n; i++) 
    {
        a[i] = pairt[i].first;
        b[i] = pairt[i].second;
    }
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b); 
}
int isPrime(int n){
    if(n < 2)
        return 0;
    if(n < 4)
        return 1;
    if(n % 2 == 0 or n % 3 == 0)
        return 0;
    for(int i = 5; i*i <= n; i += 6)
        if(n % i == 0 or n % (i+2) == 0)
            return 0;
    return 1;
}
long long C(int n, int r) {
    if(r>n-r) 
        r=n-r;
    long long ans=1;
    for(int i=1;i<=r;i++){
        ans*=n-r+i;
        ans/=i;
    }
    return ans;
}
int mod = 1e9+7;
int modexpo(int x,int p){
    int res = 1;
    x = x%mod;
    while(p){
        if(p%2)
            res = res * x;
        p >>= 1;
        x = x*x % mod;
        res %= mod;
    }
    return res;
}
double l;
int32_t main()
{
    IOS;
    cin>>l,l/=3;
    cout<<fixed<<setprecision(10)<<l*l*l;
    return 0;
}

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



#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ret pair<map<int, int>::iterator, bool>>

int main()
{   
    ll n;
    cin>>n;
    vector<ll>v;
      f[100005]={0};
    for(ll i=0;i<n;i++)
    {
           ll x;
           cin>>x;
           v.push_back(x);
           f[x]++;
    }
    map<ll , ll>m;
    ll all=0;
    for(ll i=0;i<=100000;i++)
    {
        if(f[i]>1)
        {
            ll val=(f[i]*(f[i]-1))/2;
            m.insert(make_pair(i, val));
            all+=val;
        }
    }
    if(m.size()==0)
    {
        for(ll i=0;i<n;i++)
        {
            cout<<0<<" "<<endl;
        }
    }
    else{
        ll tall=all;
       for(ll i=0;i<n;i++)
       {
           if(m.count(v[i])>0)
           {
              all-=m[v[i]];
              f[v[i]]--;
              ll temp=f[v[i]];
              f[v[i]]++;
              all+=(temp*(temp-1))/2;
              cout<<all<<endl;
           }
           else
           {
               cout<<all<<endl;
           }
           all=tall;
       }
    }





    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: 'f' was not declared in this scope
   13 |       f[100005]={0};
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
#define rep(i,n) for(int i=0; i<n; i++)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてから使う
#define INF 2147483647
#define LLINF 9223372036854775807LL

int main(){
  int n; cin>>n;
  vector<int>A(n);
  rep(i,n) cin>>A[i];
  map<int, int>mp;
  rep(i,n) mp[A[i]]++;
  for(auto p:mp){
    if(p.second >= 2) ans += p.second*(p.second-1)/2;
  }
  rep(i,n){
    ll ans = 0;
    if (mp[A[i]]>1){
      ans -= mp[A[i]]-1;
    }
    cout << ans << endl;
    ans += mp[A[i]]-1;
  }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |     if(p.second >= 2) ans += p.second*(p.second-1)/2;
      |                       ^~~
      |                       abs
Language: C++

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

int main(){
int t;cin>>t;
  vector<int>k;
  unordered_map<int,int> p;
  for(int i=0;i<t;i++){
    cin>>k[i];
  p[k[i]]++;}
  for(int i=0;i<t;i++){
  //int f=p[k[i]]-1;
    int d=0;
    for(auto x : p){
    if(x.first==k[i])
         d+= (x.second-1)*(x.second-1-1)/2; }
    else{
    d+=(x.second)*(x.second-1)/2;
    
    }
  }
  cout<<d<<endl;}
  
  
  
//for(int 
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'else' without a previous 'if'
   18 |     else{
      |     ^~~~
a.cc:19:9: error: 'x' was not declared in this scope
   19 |     d+=(x.second)*(x.second-1)/2;
      |         ^
a.cc:23:9: error: 'd' was not declared in this scope
   23 |   cout<<d<<endl;}
      |         ^
a.cc: At global scope:
a.cc:28:1: error: expected unqualified-id before 'return'
   28 | return 0;}
      | ^~~~~~
a.cc:28:10: error: expected declaration before '}' token
   28 | return 0;}
      |          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;map<int>mp;vector<int>V(N);
  for(int X=0;X<N;X++){
    cin>>V[X];mp[V[X]]++;
  }
  long long K=0;
  for(int X=0;X<N;X++){
    mp[V[X]]--;int L=0;
    for(auto p:mp){
      int J=p.second;
      L+=J*(J-1)/2;
    }
    mp[V[X]]++;K+=L;
  }
  cout<<K<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:23: error: wrong number of template arguments (1, should be at least 2)
    4 |   int N;cin>>N;map<int>mp;vector<int>V(N);
      |                       ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:6:17: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
    6 |     cin>>V[X];mp[V[X]]++;
      |                 ^
a.cc:10:7: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   10 |     mp[V[X]]--;int L=0;
      |       ^
a.cc:11:16: error: 'begin' was not declared in this scope
   11 |     for(auto p:mp){
      |                ^~
a.cc:11:16: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:11:16: error: 'end' was not declared in this scope
   11 |     for(auto p:mp){
      |                ^~
a.cc:11:16: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:15:7: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   15 |     mp[V[X]]++;K+=L;
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 159, task d, 2020/09/08
//ms,
/*
方針は完璧だった。
recをintにしたのがバグの原因。
recそのものがintでおさまらないことはない。
だけどcasesに加えるとき、右辺の計算が一度intで処理されてしまうんだと思う。
recをint64_tにしたら通るし、右辺の計算時に一部にint64_tを含めばそれだけで勝ち。
*/

int main(void){
  int N;
  vector<int> rec(200001);//インデックスはボールに書かれた数字、要素は個数
  vector<int> a;
  int64_t cases=0;

  for(int i=0;i<200000;i++) rec[i]=0;

  cin >>N;
  for(int i=0;i<N;i++){
    int tmp_a;
    cin >>tmp_a;
    rec[tmp_a]++;
    a.push_back(tmp_a);
  }


  for(int i=1;i<200000;i++) cases= cases+*rec[i]*(rec[i]-1)/2;

  for(int i=0;i<N;i++){
    int same_balls =rec[a[i]];
    int64_t ans=cases - same_balls*(same_balls-1)/2;
    ans += (same_balls-1)*(same_balls-2)/2;
    cout <<ans <<endl;

  }


  return 0;
}
/*
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:31:42: error: invalid type argument of unary '*' (have '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   31 |   for(int i=1;i<200000;i++) cases= cases+*rec[i]*(rec[i]-1)/2;
Language: C++

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'n' was not declared in this scope
   19 |   rep(i,n){
      |         ^
a.cc:2:39: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                       ^
Language: C++

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

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N),cnt(N);
  rep(i,N){
    cin >> A[i];
    A[i]--;
  }

  int tot = 0;
  rep(i,N){
    tot += choose2(cnt[i]);
  }
  rep(i,N){
    ll ans = tot;
    ans -= choose2(cnt[a[i]]);
    ans += choose2(cnt[a[i]-1]);
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:24: error: 'a' was not declared in this scope
   26 |     ans -= choose2(cnt[a[i]]);
      |                        ^
Language: C++

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

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

    ll sum=0;
    rep(i, N){
        int aaaa=i+1;
        sum+=num[a]*(num[a]-1)/2;
    }

    rep(i, N){
        ll sum_sub=sum;
        sum_sub-=(num[A[i]]-1)*num[A[i]]/2;
        sum_sub+=(num[A[i]]-2)*(num[A[i]]-1)/2;
        cout<<sum_sub<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: 'a' was not declared in this scope
   20 |         sum+=num[a]*(num[a]-1)/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[] num = new int[n];
        Map<Integer, Long> map = new HashMap<>();
        for(int i = 0; i < n; i++){
        	int number = sc.nextInt();
            num[i] = number;
            if(map.containsKey(number)){
            	map.put(number, map.get(number) + 1);
            }else{
            	map.put(number, 1);
            }
        }
        long total = 0;
        for(int key: map.keySet()){
            total += (map.get(key) * (map.get(key) - 1)) / 2;
        }
        for(int i = 0; i < n; i++){
        	long lb = (map.get(num[i]) * (map.get(num[i]) - 1)) / 2;
            long la = ((map.get(num[i]) - 1) * (map.get(num[i]) - 2)) / 2;
            System.out.println(total - lb + la);
        }
	}
}

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

#include <bits/stdc++.h>
#define pb push_back
#define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define fr first
#define sc second
using namespace std;
int main()
{
    ///freopen("input.txt" , "r" , stdin );
    ///freopen("output.txt", "w" , stdout );
    ///Murtazoev_2007
    speed ;
    ///Autor of the greatest code :: Ahmadjon Murtazoev
    ll a , z = 0 ;
    cin >> a ;
    ll ar[a] ;
    ll arr[a] ;
    for (ll i = 0 ; i<a ; i ++ )
    {
        cin >> ar[i] ;
        arr[i] = ar[i] ;
    }
    sort (arr, arr+a) ;
    for (ll i = 0 ;  i<a-1; i ++ )
    {
        if (arr[i] == arr[i+1])
        {
            z ++ ;
        }
    }
    if (z == 0)
    {
        for (ll i = 0 ;  i<a ; i ++ )
        {
            cout << 0 << " " ;
        }
        return 0 ;
    }
    if (z%2!=0)
    {
        if (z == a-1)
        {
            for (ll i = 0 ; i<a ; i ++ )
            {
                cout << ar[i]*2 << " " ;
            }
        }
        else
        {
            for (ll i = 0 ; i<a ; i ++ )
            {
                cout << ar[i]+1 << " " ;
            }
        }
    }
    else
    {
        if (z == a-1)
        {
            for (ll i = 0 ; i<a ; i ++ )
            {
                cout << ar[i]*2 << " " ;
            }
        }
    }
    return 0 ;
}


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

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;map<int,int> m;vector<int>vc;
    int ar[n];for(int i=0;i<n;i++){cin>>ar[i];m[ar[i]]++;vc.push_back(ar[i]);}
    ///--------------------------------------------------------------------///
    sort(vc.begin(),vc.end());
    for(size_t i=1;i<vc.size();i++)
    {
        if(vc[i]==vc[i-1])
        {
            vc.erase(vc.begin()+i);
            i--;
        }
    }
    ///--------------------------------///
    for(int i=0;i<n;i++)
    {
        m[ar[i]]--;
        ///----------///
        long long ans=0;
        for(auto j:vc)
        {
            ans+=(m[j]*(m[j]-1))/2;
        }
        cout<<ans<<endl;
        ///----------///
        m[ar[i]]++;
    }


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

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0;i < n;i++){
        cin >> a[i];
        a[i]--;
    }
    vector<int> c(n,0);
    for (int i = 0;i < n;i++){
        c[a[i]]++;
    }
    int sum = 0;
    for (int i = 0; i < n; i++){
        sum += c[i]*(c[i]-1)/2;
    }
    //cout << sum << endl;

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

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

#include<bits/stdc++.h>
using namespace std;
typedef vector< vector<int> > vvi;
typedef vector< vector<bool> > vvb;
typedef vector< vector<char> > vvc;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    map<long long,long long> mp;
    vactor<long long> va(n);
    for(int i=0;i<n;i++){
        long long a;
        cin >> a;
        mp[a]++;
        va[i]=a;
    }
    long long all=0;
    for(auto x: mp){
        all+=x.second*(x.second-1)/2;
    }
    long long diff;
    for(int i=0;i<n;i++){
        diff=mp[va[i]]-1;
        cout << all-diff << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'vactor' was not declared in this scope
   15 |     vactor<long long> va(n);
      |     ^~~~~~
a.cc:15:12: error: expected primary-expression before 'long'
   15 |     vactor<long long> va(n);
      |            ^~~~
a.cc:20:9: error: 'va' was not declared in this scope; did you mean 'a'?
   20 |         va[i]=a;
      |         ^~
      |         a
a.cc:28:17: error: 'va' was not declared in this scope; did you mean 'vi'?
   28 |         diff=mp[va[i]]-1;
      |                 ^~
      |                 vi
Language: C++

#define MAX_N 200'000

using namespace std;

int A[MAX_N];

int f(int n) {
  if (n == 0 || n == 1) {
    return 1;
  }
  int ret = 1;
  for (int i = 2; i <= n; ++i) {
    ret *= i;
  }
  return ret;
}

int c(int n, int k) { return f(n) / f(n - k) / f(k); }

int main() {
  int N;
  cin >> N;
  unordered_map<int, int> M1;
  unordered_map<int, int> M2;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    ++M1[A[i]];
  }
  for (auto &m : M1) {
    int t = 0;
    for (auto &_m : M1) {
      int v = _m.second - (m.first == _m.first);
      t += c(v, 2);
    }
    M2[m.first] = t;
  }
  for (int i = 0; i < N; ++i) {
    printf("%d\n", M2[A[i]]);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: 'cin' was not declared in this scope
   22 |   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 | #define MAX_N 200'000
a.cc:23:3: error: 'unordered_map' was not declared in this scope
   23 |   unordered_map<int, int> M1;
      |   ^~~~~~~~~~~~~
a.cc:1:1: note: 'std::unordered_map' is defined in header '<unordered_map>'; this is probably fixable by adding '#include <unordered_map>'
  +++ |+#include <unordered_map>
    1 | #define MAX_N 200'000
a.cc:23:17: error: expected primary-expression before 'int'
   23 |   unordered_map<int, int> M1;
      |                 ^~~
a.cc:24:17: error: expected primary-expression before 'int'
   24 |   unordered_map<int, int> M2;
      |                 ^~~
a.cc:27:7: error: 'M1' was not declared in this scope
   27 |     ++M1[A[i]];
      |       ^~
a.cc:29:18: error: 'M1' was not declared in this scope
   29 |   for (auto &m : M1) {
      |                  ^~
a.cc:35:5: error: 'M2' was not declared in this scope
   35 |     M2[m.first] = t;
      |     ^~
a.cc:38:20: error: 'M2' was not declared in this scope
   38 |     printf("%d\n", M2[A[i]]);
      |                    ^~
a.cc:38:5: error: 'printf' was not declared in this scope
   38 |     printf("%d\n", M2[A[i]]);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define MAX_N 200'000
Language: C++

#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
typedef long long ll;

ll func(ll n){
	if(n<=1) return 0;
	return n*(n-1)/2;
}

int main(){
	ll n;
	cin >> n;
	vector<ll> a(n);
	REP(i,n) cin >> a[i];
	
	vector<ll> b(200005,0);
	set<llogbf32> s;
	
	REP(i,n){
		b[a[i]] += 1;
		s.insert(a[i]);
	}
	ll count=0;
	vector<ll> ans(n);
	
	for(ll i: s){
		count += func(b[i]);
	}
	REP(i,n){
		ans[i] = func(b[a[i]]-1) - func(b[a[i]]);
	}
	REP(i,n) ans[i] += count;
	
	REP(i,n) cout << ans[i] << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:21: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Key, class _Compare, class _Alloc> class std::set'
   29 |         set<llogbf32> s;
      |                     ^
a.cc:29:21: note:   expected a type, got 'llogbf32'
a.cc:29:21: error: template argument 2 is invalid
a.cc:29:21: error: template argument 3 is invalid
a.cc:33:19: error: request for member 'insert' in 's', which is of non-class type 'int'
   33 |                 s.insert(a[i]);
      |                   ^~~~~~
a.cc:38:19: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   38 |         for(ll i: s){
      |                   ^
      |                   std::begin
In file included from /usr/include/c++/14/vector:69,
                 from a.cc:3:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:38:19: error: 'end' was not declared in this scope; did you mean 'std::end'?
   38 |         for(ll i: s){
      |                   ^
      |                   std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
Language: C++

int N;
vector<long long> a;

void solve() {
    map<long long, long long> ma;
    for (int i = 0; i < N; ++i) ma[a[i]]++;
    long long res = 0;
    for (auto it : ma) res += it.second * (it.second - 1) / 2;
    for (int i = 0; i < N; ++i) {
        long long val = ma[a[i]];
        long long before = val * (val - 1) / 2;
        long long after = (val - 1) * (val - 2) / 2;
        cout << res + after - before << endl;
    }
}

int main() {
    cin >> N;
    a.resize(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    solve();
}

Compiler output:
a.cc:2:1: error: 'vector' does not name a type
    2 | vector<long long> a;
      | ^~~~~~
a.cc: In function 'void solve()':
a.cc:5:5: error: 'map' was not declared in this scope
    5 |     map<long long, long long> ma;
      |     ^~~
a.cc:5:9: error: expected primary-expression before 'long'
    5 |     map<long long, long long> ma;
      |         ^~~~
a.cc:6:33: error: 'ma' was not declared in this scope
    6 |     for (int i = 0; i < N; ++i) ma[a[i]]++;
      |                                 ^~
a.cc:6:36: error: 'a' was not declared in this scope
    6 |     for (int i = 0; i < N; ++i) ma[a[i]]++;
      |                                    ^
a.cc:8:20: error: 'ma' was not declared in this scope
    8 |     for (auto it : ma) res += it.second * (it.second - 1) / 2;
      |                    ^~
a.cc:10:25: error: 'ma' was not declared in this scope
   10 |         long long val = ma[a[i]];
      |                         ^~
a.cc:10:28: error: 'a' was not declared in this scope
   10 |         long long val = ma[a[i]];
      |                            ^
a.cc:13:9: error: 'cout' was not declared in this scope
   13 |         cout << res + after - before << endl;
      |         ^~~~
a.cc:13:41: error: 'endl' was not declared in this scope
   13 |         cout << res + after - before << endl;
      |                                         ^~~~
a.cc: In function 'int main()':
a.cc:18:5: error: 'cin' was not declared in this scope
   18 |     cin >> N;
      |     ^~~
a.cc:19:5: error: 'a' was not declared in this scope
   19 |     a.resize(N);
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define tcase int _; cin >> _; while(_--)
const int MAX = 1e6;

int n, v[MAX], a[MAX];
long long t, ans;

void solve() {
	memset(v, 0, sizeof v);
	cin >> n;
	for(int i=0; i<n; i++) {
		int x;
		cin >> x;
		v[x]++;
		a[i] = x;
	}
	
	t = 0ll;
       	for(int i=1; i<=n; i++) {
		t += (ll)((v[i] * (v[i]-1)) >> 1);
	}
	
	for(int i=0; i<n; i++) {
		ans = t;//-v[a[i]]+1;
		// if(v[a[i]]) ans += (ll)((v[a[i]]-1) * (v[a[i]]-2) >> 1) - (ll)(v[a[i]] * (v[a[i]]-1)>>1) +;
		// if(v[a[i]]) ans += 1-n;
		if(v[a[i]]) ans += 1-v[a[i]]
		cout << ans << "\n";
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

 	solve();

  	return 0;
}



Compiler output:
a.cc: In function 'void solve()':
a.cc:29:45: error: expected ';' before 'cout'
   29 |                 if(v[a[i]]) ans += 1-v[a[i]]
      |                                             ^
      |                                             ;
   30 |                 cout << ans << "\n";
      |                 ~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

// int ball_counter[100];
// int ball_selection[100];


long long ball_counter[200100];
long long ball_selection[200100];


int main(){
    long long N;
    cin >> N;
    vector<long long> a(N);
    for(long long i=0; i<N; ++i) cin >> a[i];

    for(long long i=0; i<N; ++i){
        ball_counter[a[i]]++;
    }

    for(long long i=0; i<200100; ++i){
        if(ball_counter[i] > 1){
            // if(ball_counter[i] %2 == 0){
            //     ball_selection[i] = ball_counter[i]/2 ;
            //     ball_selection[i] *= (ball_counter[i] - 1);
            // }else{
            //     ball_selection[i] = (ball_counter[i] - 1)/2;
            //     ball_selection[i] *= ball_counter[i] ;
            // }
            // ball_selection[i] = ball_counter[i] * (ball_counter[i] - 1 )/2;

            ball_selection[i] = ball_counter[i] * (ball_counter[i] - 1 )
            ball_selection[i] /= 2;
        }
    }

    long long total = 0;
    for(long long i=0; i<200100; ++i){
        total += ball_selection[i];
    }


    for(int i=0; i<N; ++i){
        long long ans;

        // if( ball_counter[a[i]] - 1 < 2 ){
        //     ans = total;
        // }else{
        ans = total - (ball_counter[a[i]] - 1);
//         }

        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:73: error: expected ';' before 'ball_selection'
   35 |             ball_selection[i] = ball_counter[i] * (ball_counter[i] - 1 )
      |                                                                         ^
      |                                                                         ;
   36 |             ball_selection[i] /= 2;
      |             ~~~~~~~~~~~~~~
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);





int main() 
{
  ll N; cin>>N;
  map<ll,ll> list;
  vector<ll> A(N);
  rep(i,N)
  {
    cin>>A.at(i);
    if(list.count(A.at(i))) {list.at(A.at(i))++; continue;}
    list[A.at(i)]=1;
  }
  ll ans=0;
  for(auto p:list)
  {
    ll hoge=p.second;
    ans+=(hoge*(hoge-1)/2;
  }
  rep(k,N)
  {
    ll a=A.at(k);
    ll count=list.at(a);
    cout<<ans-(count-1)<<endl;
  }  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: expected ')' before ';' token
   28 |     ans+=(hoge*(hoge-1)/2;
      |          ~               ^
      |                          )
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a[N],b[N];
  for(int i=0;i<N,i++) b[i]=0;
  for(int i=0;i<N;i++){
    cin>>a[i];
    b[a[i]-1]++;
  }
  int c=0;
  for(int i=0;i<N;i++) c+=(b[i]*(b[i]-1))/2;
  int ans[N];
  for(int i=0;i<N;i++){
    ans[i]-(b[i]-1);
    cout<<ans[i]<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: expected ';' before ')' token
    7 |   for(int i=0;i<N,i++) b[i]=0;
      |                      ^
      |                      ;
Language: C++

#include<cstdio>
using ll = long long;
const static unsigned MAX_N = 200000;
ll bucket[MAX_N+1];

int main(){
    unsigned N;
    scanf("%u", &N);
    unsigned A[N];
    for(int i = 0; i < N; ++i){
        scanf("%u", A + i);
        bucket[A[i]]++;
    }
    ull answer = 0;
    for (size_t i = 0; i < N; i++){
        answer += bucket[i]*(bucket[i] - 1) >> 1;
    }
    for (size_t i = 0; i < N; i++){
        printf("%llu\n", answer + 1 - bucket[A[i]]);
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'ull' was not declared in this scope; did you mean 'll'?
   14 |     ull answer = 0;
      |     ^~~
      |     ll
a.cc:16:9: error: 'answer' was not declared in this scope
   16 |         answer += bucket[i]*(bucket[i] - 1) >> 1;
      |         ^~~~~~
a.cc:19:26: error: 'answer' was not declared in this scope
   19 |         printf("%llu\n", answer + 1 - bucket[A[i]]);
      |                          ^~~~~~
Language: C++

#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
  int N;
  cin>>N;
  int A[200000],B[200001];
  for(int i=0;i<N;i++){
    cin>>A[i];
    B[i+1]=0;
  }
  for(int i=0;i<N;i++){
    B[A[i]]++;
  }
  long long answer=0;
  long long c[200001];
  for(int i=1;i<=N;i++){
    c[i]=(B[i]*(B[i]-1))/2;
    answer+=c[i];
  }
  for(int i=0;i<N;i++){
    cout<<answer-c[A[i]]+((B[A[i]-1)*(B[A[i]]-2))/2<<endl;
  }
  
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:36: error: expected ']' before ')' token
   23 |     cout<<answer-c[A[i]]+((B[A[i]-1)*(B[A[i]]-2))/2<<endl;
      |                                    ^
      |                                    ]
Language: C++

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

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    rep(i, n) a.at(i)--;
    vector<int> cnt(n);
    rep(i, n) cnt.at(a.at(i))++;

    ll tot = 0;
    rep(i, n) {
        tot += choose2(cnt.at(i));
    }

    rep(i, n) {
        ll ans = tot;
        ans -= choose(cnt.at(a.at(i));
        cnt.at(a.at(i))--;
        ans += choose2(cnt.at(a.at(i));
    }
    return 0;
}

Compiler output:
a.cc:7:1: error: 'll' does not name a type
    7 | ll choose2(ll n) {
      | ^~
a.cc: In function 'int main()':
a.cc:21:5: error: 'll' was not declared in this scope
   21 |     ll tot = 0;
      |     ^~
a.cc:23:9: error: 'tot' was not declared in this scope
   23 |         tot += choose2(cnt.at(i));
      |         ^~~
a.cc:23:16: error: 'choose2' was not declared in this scope; did you mean 'close'?
   23 |         tot += choose2(cnt.at(i));
      |                ^~~~~~~
      |                close
a.cc:27:11: error: expected ';' before 'ans'
   27 |         ll ans = tot;
      |           ^~~~
      |           ;
a.cc:28:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |         ans -= choose(cnt.at(a.at(i));
      |         ^~~
      |         abs
a.cc:28:38: error: expected ')' before ';' token
   28 |         ans -= choose(cnt.at(a.at(i));
      |                      ~               ^
      |                                      )
a.cc:30:39: error: expected ')' before ';' token
   30 |         ans += choose2(cnt.at(a.at(i));
      |                       ~               ^
      |                                       )
Language: C++

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

int tri_n(int a)
{
	a--;
	return ((a * (a+1)) / 2);
}


int  main()
{
	int n ; cin >> n;
	vector<int> a(n);
	unordered_map<int, int> mp;
	rep(i, n)
	{
		cin >> a[i];
		mp[a[i]]++;
	}
	int sum = 0;
	set<int> st;
	rep(i, n)
	{
		if (!st.count(a[i]))
		{
			st.insert(a[i]);
			sum += tri_n(mp[a[i]]);
		}
	}
	rep(i, n)
	{
		cout << sum - ( tri_n(mp[a[i]]) - tri_n(mp[a[i]] - 1) ) << endl;
	}
	return 0;
}

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

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a.at(i);
        //cout << a.at(i);
    }

    int sum;
    rep(i, n) {
        sum = 0;
        rep(j, n) {
            if (j == i)
                continue;

            rep2(k, j + 1, n) {
                if (k == j || k == i)
                    continue;

                if (a.at(k) == a.at(j))
                    sum++;
            }
        }
        cout << sum << endl;
    }
    return 0;
}

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

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a.at(i);
        //cout << a.at(i);
    }

    int sum;
    rep(i, n) {
        sum = 0;
        rep(j, n) {
            //cout << "0000" << endl;
            if (j == i)
                continue;

            //cout << "1111" << endl;

            rep2(k, j + 1, n) {
                //cout << "k=" << k << endl;
                if (k == j || k == i)
                    continue;

                //cout << "k=" << k <<endl;
                if (a.at(k) == a.at(j))
                    sum++;
            }
        }
        cout << sum << endl;
    }
    return 0;
}

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

#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int a[200005];
int kosu[200005];
int select[200005] = {};
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		kosu[a[i]]++;
	}
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		select[a[i]] = (kosu[a[i]] * (kosu[a[i]] - 1)) / 2;
	}

	for (int i = 0; i <= n; i++) {
		sum += select[i];
	}
	

	for (int i = 0; i < n; i++) {
		ll ans = sum;
		ans = ans - select[a[i]] + ((kosu[a[i]] - 1) * (kosu[a[i]] - 2)) / 2;
		cout << ans << endl;
	}
	
	return 0;

}


Compiler output:
a.cc:12:18: error: 'int select [200005]' redeclared as different kind of entity
   12 | int select[200005] = {};
      |                  ^
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:179,
                 from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/bits/std_abs.h:38,
                 from /usr/include/c++/14/cmath:49,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/sys/select.h:102:12: note: previous declaration 'int select(int, fd_set*, fd_set*, fd_set*, timeval*)'
  102 | extern int select (int __nfds, fd_set *__restrict __readfds,
      |            ^~~~~~
a.cc: In function 'int main()':
a.cc:22:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   22 |                 select[a[i]] = (kosu[a[i]] * (kosu[a[i]] - 1)) / 2;
      |                            ^
a.cc:22:30: error: assignment of read-only location '*(select + ((sizetype)a[i]))'
   22 |                 select[a[i]] = (kosu[a[i]] * (kosu[a[i]] - 1)) / 2;
      |                 ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:26:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   26 |                 sum += select[i];
      |                                ^
a.cc:26:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   26 |                 sum += select[i];
      |                 ~~~~^~~~~~~~~~~~
a.cc:26:21: error: invalid conversion from 'int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)' to 'll' {aka 'long long int'} [-fpermissive]
   26 |                 sum += select[i];
      |                 ~~~~^~~~~~~~~~~~
      |                     |
      |                     int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)
a.cc:32:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                 ans = ans - select[a[i]] + ((kosu[a[i]] - 1) * (kosu[a[i]] - 2)) / 2;
      |                                        ^
a.cc:32:27: error: invalid operands of types 'll' {aka 'long long int'} and 'int(int, fd_set*, fd_set*, fd_set*, timeval*)' to binary 'operator-'
   32 |                 ans = ans - select[a[i]] + ((kosu[a[i]] - 1) * (kosu[a[i]] - 2)) / 2;
      |                       ~~~ ^ ~~~~~~~~~~~~
      |                       |                |
      |                       |                int(int, fd_set*, fd_set*, fd_set*, timeval*)
      |                       ll {aka long long int}
Language: C++

#include<stdio.h>
long long fun(int n)
{
    return n*(n-1)/2;
}
int main()
{
    int n,a[200001],cnt[200001]
    long long x=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(int i=0;i<n;i++)
    {
        cnt[i]=0;
    }
    for(int i=0;i<n;i++)
    {
        cnt[a[i]]++;
    }
    for(int i=0;i<n;i++)
    {
        x+=fun(cnt[i]);
    }
    for(int i=0;i<n;i++)
    {
        printf("%lld\n",(long long)(x-(fun(cnt[a[i]])-fun(cnt[a[i]]-1))));
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: expected initializer before 'long'
    9 |     long long x=0;
      |     ^~~~
a.cc:15:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   15 |         cnt[i]=0;
      |         ^~~
      |         int
a.cc:19:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   19 |         cnt[a[i]]++;
      |         ^~~
      |         int
a.cc:23:9: error: 'x' was not declared in this scope
   23 |         x+=fun(cnt[i]);
      |         ^
a.cc:23:16: error: 'cnt' was not declared in this scope; did you mean 'int'?
   23 |         x+=fun(cnt[i]);
      |                ^~~
      |                int
a.cc:27:37: error: 'x' was not declared in this scope
   27 |         printf("%lld\n",(long long)(x-(fun(cnt[a[i]])-fun(cnt[a[i]]-1))));
      |                                     ^
a.cc:27:44: error: 'cnt' was not declared in this scope; did you mean 'int'?
   27 |         printf("%lld\n",(long long)(x-(fun(cnt[a[i]])-fun(cnt[a[i]]-1))));
      |                                            ^~~
      |                                            int
Language: C

#include<stdio.h>

int main() {
	int  n, a[200000], b[200000] = {},sum=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++) {
		sum += b[i] * (b[i] - 1) / 2;
	}
	for (int i = 0; i < n; i++) {
		printf("%d\n", sum-b[a[i]+1);
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:44: error: expected ']' before ')' token
   14 |                 printf("%d\n", sum-b[a[i]+1);
      |                                            ^
      |                                            ]
Language: C++

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

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

int main() {
  int n; cin >> n;
  vector<int> a(n);
  vector<int> b(n,0);
  for(int i=0; i<n; i++){
    cin >> a[i];
    a[i]--;
    b[a[i]]++;
  }
  long total = 0;
  for(int i=0; i<n; i++){
    total += choose(b[i]);
  }
  for(int i=0; i<n; i++){
    long l = choose((b[a[i]]);
    long m = choose((b[a[i]]-1);
    cout << total - l + m << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:30: error: expected ')' before ';' token
   22 |     long l = choose((b[a[i]]);
      |                    ~         ^
      |                              )
a.cc:23:32: error: expected ')' before ';' token
   23 |     long m = choose((b[a[i]]-1);
      |                    ~           ^
      |                                )
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:40: error: expected ']' before ')' token
   17 |     cout << total - ((b[i]) * (b[a[i]-1) /2) + ((b[i]-1) * (b[i]-2) /2) << endl;
      |                                        ^
      |                                        ]
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:52: error: expected ')' before ';' token
   17 |     cout << total - ((b[a[i]-1]) * (b[a[i]-1]-1) /2;) + ((b[a[i]-1]-1) * (b[a[i]-1]-2) /2) << endl;
      |                     ~                              ^
      |                                                    )
a.cc:17:53: error: expected primary-expression before ')' token
   17 |     cout << total - ((b[a[i]-1]) * (b[a[i]-1]-1) /2;) + ((b[a[i]-1]-1) * (b[a[i]-1]-2) /2) << endl;
      |                                                     ^
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    ll N;
    cin>>N;
    
    map<ll,ll> a;
    VEC(ll,A,N);
    REP(i,N){
        ll h;
        cin>>h;
        A[i]=h;
        if(a.count(h)==0)a[h]=1;
        else a[h]++;
    }
    REP(i,N){
        a[A[i]]--;
        ll cnt=0;
        for (const v: a){
            cnt+=v*(v-1)/2;
        }
        a[A[i]]++;
        sl(cnt);
    }
    //ll t=N*M;
    //cout<<fixed<<setprecision(20)<<N*M<<endl;
    //cout<<fixed<<setprecision(0)<<floor(t);
    //N-=F;
    //cout<<N/(M+F);
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:75:20: error: 'v' does not name a type
   75 |         for (const v: a){
      |                    ^
a.cc:77:10: error: expected ';' before 'a'
   77 |         }
      |          ^
      |          ;
   78 |         a[A[i]]++;
      |         ~ 
a.cc:14:34: error: expected ')' before ';' token
   14 | #define sl(...) show(__VA_ARGS__);cout<<endl;
      |                                  ^
a.cc:79:9: note: in expansion of macro 'sl'
   79 |         sl(cnt);
      |         ^~
a.cc:75:13: note: to match this '('
   75 |         for (const v: a){
      |             ^
Language: C++

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

int main() {
    queue<int> q;
    map<int,int> m;
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        m[a[i]]++;
        if(m[a[i]==1]) q.push(a[i]);
    }
    rep(i,n){
        int sum = 0;
        m[a[i]]--;
        for(int i ; q){
            sum += (m[i]-1)*m[i]/2;
        }
        m[a[i]]++;
        cout << sum << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:21: error: could not convert 'q' from 'std::queue<int>' to 'bool'
   23 |         for(int i ; q){
      |                     ^
      |                     |
      |                     std::queue<int>
a.cc:23:22: error: expected ';' before ')' token
   23 |         for(int i ; q){
      |                      ^
      |                      ;