Language: C++

include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  vector<int>amount(n);
  vector<int>kC2(n);
  vector<int>k1C2(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    amount[a[i]-1]++;//amount_i には整数i+1のa_iに含まれる個数が入っている
  }
  for(int i=0;i<n;i++){
    if(amount[i]<2){
      kC2[i]=0;
    }
    else{
      kC2[i]=(amount[i]*(amount[i]-1))/2;
      
    }
    
  }
  for(int i=0;i<n;i++){
    if(amount[i]<3){
        k1C2[i]=0;
      
    }
    else{
      k1C2[i]=((amount[i]-1)*(amount[i]-2))/2;
      
    }
    
  }
  int sum=0;
  for(int i=0;i<n;i++){
    sum=sum+kC2[i];
  }
  for(int i=0;i<n;i++){
    cout<<sum-kC2[a[i]-1]+k1C2[a[i]-1]<<endl;
    
  }

  
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin>>n;
      |   ^~~
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int>a(n);
      |   ^~~~~~
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int>a(n);
      |          ^~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int>amount(n);
      |          ^~~
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int>kC2(n);
      |          ^~~
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int>k1C2(n);
      |          ^~~
a.cc:11:10: error: 'a' was not declared in this scope
   11 |     cin>>a[i];
      |          ^
a.cc:12:5: error: 'amount' was not declared in this scope
   12 |     amount[a[i]-1]++;//amount_i には整数i+1のa_iに含まれる個数が入っている
      |     ^~~~~~
a.cc:15:8: error: 'amount' was not declared in this scope
   15 |     if(amount[i]<2){
      |        ^~~~~~
a.cc:16:7: error: 'kC2' was not declared in this scope
   16 |       kC2[i]=0;
      |       ^~~
a.cc:19:7: error: 'kC2' was not declared in this scope
   19 |       kC2[i]=(amount[i]*(amount[i]-1))/2;
      |       ^~~
a.cc:25:8: error: 'amount' was not declared in this scope
   25 |     if(amount[i]<3){
      |        ^~~~~~
a.cc:26:9: error: 'k1C2' was not declared in this scope
   26 |         k1C2[i]=0;
      |         ^~~~
a.cc:30:7: error: 'k1C2' was not declared in this scope
   30 |       k1C2[i]=((amount[i]-1)*(amount[i]-2))/2;
      |       ^~~~
a.cc:37:13: error: 'kC2' was not declared in this scope
   37 |     sum=sum+kC2[i];
      |             ^~~
a.cc:40:5: error: 'cout' was not declared in this scope
   40 |     cout<<sum-kC2[a[i]-1]+k1C2[a[i]-1]<<endl;
      |     ^~~~
a.cc:40:15: error: 'kC2' was not declared in this scope
   40 |     cout<<sum-kC2[a[i]-1]+k1C2[a[i]-1]<<endl;
      |               ^~~
a.cc:40:19: error: 'a' was not declared in this scope
   40 |     cout<<sum-kC2[a[i]-1]+k1C2[a[i]-1]<<endl;
      |                   ^
a.cc:40:27: error: 'k1C2' was not declared in this scope
   40 |     cout<<sum-kC2[a[i]-1]+k1C2[a[i]-1]<<endl;
      |                           ^~~~
a.cc:40:41: error: 'endl' was not declared in this scope
   40 |     cout<<sum-kC2[a[i]-1]+k1C2[a[i]-1]<<endl;
      |                                         ^~~~