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

#include <iostream>
#include <set>
#include <vector>
#include <iomanip>
typedef long long int ll;

using namespace std;

int main()
{

    cin >> N;

    vector<ll> A(N, 0);

    set<ll> B;

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

        cin >> A[i];

        B.insert(A[i]);
    }

    vector<ll> num(B.size(), 0);

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

        for (int j = 0; j < B.size(); j++)
        {

            if (A[i] == B[j])

                num[j]++;
        }
    }

    ll defo = (N - 1) * N / 2;

    for (int i = 0; i < B.size(); i++)
    {

        defo = defo - [j] * (B[j] - 1) / 2;
    }

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

        for (int j = 0; j < B.size(); j++)
        {

            if (A[i] == B[j])
            {

                ll ans = defo + B[j] * (B[j] - 1) / 2 - B[j - 1] * (B[j] - 2) / 2;

                cout << ans << endl;
            }
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: 'N' was not declared in this scope
   12 |     cin >> N;
      |            ^
a.cc:34:26: error: no match for 'operator[]' (operand types are 'std::set<long long int>' and 'int')
   34 |             if (A[i] == B[j])
      |                          ^
a.cc:45:24: error: 'j' was not declared in this scope
   45 |         defo = defo - [j] * (B[j] - 1) / 2;
      |                        ^
a.cc: In lambda function:
a.cc:45:27: error: expected '{' before '*' token
   45 |         defo = defo - [j] * (B[j] - 1) / 2;
      |                           ^
a.cc: In function 'int main()':
a.cc:54:26: error: no match for 'operator[]' (operand types are 'std::set<long long int>' and 'int')
   54 |             if (A[i] == B[j])
      |                          ^
a.cc:57:34: error: no match for 'operator[]' (operand types are 'std::set<long long int>' and 'int')
   57 |                 ll ans = defo + B[j] * (B[j] - 1) / 2 - B[j - 1] * (B[j] - 2) / 2;
      |                                  ^
a.cc:57:42: error: no match for 'operator[]' (operand types are 'std::set<long long int>' and 'int')
   57 |                 ll ans = defo + B[j] * (B[j] - 1) / 2 - B[j - 1] * (B[j] - 2) / 2;
      |                                          ^
a.cc:57:58: error: no match for 'operator[]' (operand types are 'std::set<long long int>' and 'int')
   57 |                 ll ans = defo + B[j] * (B[j] - 1) / 2 - B[j - 1] * (B[j] - 2) / 2;
      |                                                          ^
a.cc:57:70: error: no match for 'operator[]' (operand types are 'std::set<long long int>' and 'int')
   57 |                 ll ans = defo + B[j] * (B[j] - 1) / 2 - B[j - 1] * (B[j] - 2) / 2;
      |                                                                      ^
Language: C++


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

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

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

#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
  ll n ;
  cin >> n ;
  vector<ll> A(n)  ;
  rep(i,n) cin>> A[i] ;
　vector<ll> cnt(n) ;
  rep(i,n) cnt[A[i]] ++ ;
  ll sum=0 ;
  rep(i,n) sum+= cnt[i]*(cnt[i]-1) /2 ;
  rep(i,n){ 
cout << sum-(cnt[i]-1) <<endl ;
  }
   
    return 0;
}

Compiler output:
a.cc:16:1: error: extended character 　 is not valid in an identifier
   16 | 　vector<ll> cnt(n) ;
      | ^
a.cc: In function 'int main()':
a.cc:16:1: error: '\U00003000vector' was not declared in this scope
   16 | 　vector<ll> cnt(n) ;
      | ^~~~~~~~
a.cc:16:12: error: expected primary-expression before '>' token
   16 | 　vector<ll> cnt(n) ;
      |            ^
a.cc:16:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 | 　vector<ll> cnt(n) ;
      |              ^~~
      |              int
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
  ll n ;
  cin　>>n ;
  vector<ll> A(n)  ;
  rep(i,n) cin>> A[i] ;
　vector<ll> cnt(n) ;
  rep(i,n) cnt[A[i]] ++ ;
  ll sum=0 ;
  rep(i,n) sum+= cnt[i]*(cnt[i]-1) /2 ;
  rep(i,n){ 
cout << sum-(cnt[i]-1) <<endl ;
  }
   
    return 0;
}



Compiler output:
a.cc:13:3: error: extended character 　 is not valid in an identifier
   13 |   cin　>>n ;
      |   ^
a.cc:16:1: error: extended character 　 is not valid in an identifier
   16 | 　vector<ll> cnt(n) ;
      | ^
a.cc: In function 'int main()':
a.cc:13:3: error: 'cin\U00003000' was not declared in this scope
   13 |   cin　>>n ;
      |   ^~~~~
a.cc:16:1: error: '\U00003000vector' was not declared in this scope
   16 | 　vector<ll> cnt(n) ;
      | ^~~~~~~~
a.cc:16:12: error: expected primary-expression before '>' token
   16 | 　vector<ll> cnt(n) ;
      |            ^
a.cc:16:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 | 　vector<ll> cnt(n) ;
      |              ^~~
      |              int
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
  ll n ;
  cin　n ;
  vector<ll> A(n)  ;
  rep(i,n) cin>> A[i] ;
　vector<ll> cnt(n) ;
  rep(i,n) cnt[A[i]] ++ ;
  ll sum=0 ;
  rep(i,n) sum+= cnt[i]*(cnt[i]-1) /2 ;
  rep(i,n){ 
cout << sum-(cnt[i]-1) <<endl ;
  }
   
    return 0;
}


Compiler output:
a.cc:13:3: error: extended character 　 is not valid in an identifier
   13 |   cin　n ;
      |   ^
a.cc:16:1: error: extended character 　 is not valid in an identifier
   16 | 　vector<ll> cnt(n) ;
      | ^
a.cc: In function 'int main()':
a.cc:13:3: error: 'cin\U00003000n' was not declared in this scope
   13 |   cin　n ;
      |   ^~~~~~
a.cc:16:1: error: '\U00003000vector' was not declared in this scope
   16 | 　vector<ll> cnt(n) ;
      | ^~~~~~~~
a.cc:16:12: error: expected primary-expression before '>' token
   16 | 　vector<ll> cnt(n) ;
      |            ^
a.cc:16:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 | 　vector<ll> cnt(n) ;
      |              ^~~
      |              int
Language: C++

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

#define F first
#define S second
typedef double db;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll gcd(ll x,ll y){
return y? gcd(y,x%y):x;
}

int main(){
  ll n,sum=0;
  cin>>n;
  vector<int> v(n);
  rep(i,n)cin>>v[i];
  map<int,int> mp;
  rep(i,n){
  int a=v[i];
  mp[a]++;
  }
  for(ll i=1;i<=n;++i){
  ll b=mp[i]*(max(mp[i]-1,0))/2;
  sum+=b;
  }
  rep(i,n){
  int c=v[i];
  cout<<sum-mp[c]+1<<endl;
  }
return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc:11:9: error: 'pair' does not name a type
   11 | typedef pair<int,int> pii;
      |         ^~~~
a.cc:12:9: error: 'pair' does not name a type
   12 | typedef pair<ll,ll> pll;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:20:3: error: 'cin' was not declared in this scope
   20 |   cin>>n;
      |   ^~~
a.cc:21:3: error: 'vector' was not declared in this scope
   21 |   vector<int> v(n);
      |   ^~~~~~
a.cc:21:10: error: expected primary-expression before 'int'
   21 |   vector<int> v(n);
      |          ^~~
a.cc:22:16: error: 'v' was not declared in this scope
   22 |   rep(i,n)cin>>v[i];
      |                ^
a.cc:23:3: error: 'map' was not declared in this scope
   23 |   map<int,int> mp;
      |   ^~~
a.cc:23:7: error: expected primary-expression before 'int'
   23 |   map<int,int> mp;
      |       ^~~
a.cc:25:9: error: 'v' was not declared in this scope
   25 |   int a=v[i];
      |         ^
a.cc:26:3: error: 'mp' was not declared in this scope
   26 |   mp[a]++;
      |   ^~
a.cc:29:8: error: 'mp' was not declared in this scope
   29 |   ll b=mp[i]*(max(mp[i]-1,0))/2;
      |        ^~
a.cc:29:15: error: 'max' was not declared in this scope
   29 |   ll b=mp[i]*(max(mp[i]-1,0))/2;
      |               ^~~
a.cc:33:9: error: 'v' was not declared in this scope
   33 |   int c=v[i];
      |         ^
a.cc:34:3: error: 'cout' was not declared in this scope
   34 |   cout<<sum-mp[c]+1<<endl;
      |   ^~~~
a.cc:34:13: error: 'mp' was not declared in this scope
   34 |   cout<<sum-mp[c]+1<<endl;
      |             ^~
a.cc:34:22: error: 'endl' was not declared in this scope
   34 |   cout<<sum-mp[c]+1<<endl;
      |                      ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
cin >> N;
int num[210000];
int nums[210000];
for(int i = 0; i < N; i++){
cin >> num[i];
num[i]--;
}
for(int i = N; i < N; i++){
nums[i] = 0;

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

}
int wa;
for(int i = N; i < N; i++){
wa += (nums[i] * (nums[i]-1)) / 2;

}
int wa;
for(int i = N; i < N; i++){
wa -= (nums[i]-1 * (nums[i]-2)) / 2;

}

cout << wa << endl;

} 

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: redeclaration of 'int wa'
   26 | int wa;
      |     ^~
a.cc:21:5: note: 'int wa' previously declared here
   21 | int wa;
      |     ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int a[100005];
int cnt[1000005];//For counting how many balls have x written on it


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

Compiler output:
a.cc: In function 'int main()':
a.cc:19:22: error: 'i' was not declared in this scope
   19 |     cout<<ans-(cnt[a[i]]-1)<<endl;
      |                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll dp[200200];
int main(){
    fast_io

    int n;
    cin>>n;
    vector<int> a(n);
    ll N=0;
    ll sum=0;
    rep(i,n) {
        cin>>a[i];
        a[i]--;
        dp[a[i]]++;
        N=max(N, a[i]);
    }

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



    return 0;

}


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

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

int main() {
  ll N,ans;
  cin >> N;
  vector<ll>tmp(N);
  map<ll,ll> num{};
  for(int i=0;i<N;i++) {
    cin >> tmp.at(i);
    num[tmp.at(i)]++;
  }

  for(int i=0;i<N;i++) {
	ans=0;
    num[tmp.at(i)]--;
    for (auto x : num){
      //cout << x.first << " - " << x.second << endl;
      ans+=x.second*(x.second-1)/2;
    }
    num[tmp.at(i)]++;
    cout << ans << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'll' was not declared in this scope
    5 |   ll N,ans;
      |   ^~
a.cc:6:10: error: 'N' was not declared in this scope
    6 |   cin >> N;
      |          ^
a.cc:7:12: error: template argument 2 is invalid
    7 |   vector<ll>tmp(N);
      |            ^
a.cc:8:12: error: template argument 3 is invalid
    8 |   map<ll,ll> num{};
      |            ^
a.cc:8:12: error: template argument 4 is invalid
a.cc:10:16: error: request for member 'at' in 'tmp', which is of non-class type 'int'
   10 |     cin >> tmp.at(i);
      |                ^~
a.cc:11:13: error: request for member 'at' in 'tmp', which is of non-class type 'int'
   11 |     num[tmp.at(i)]++;
      |             ^~
a.cc:15:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |         ans=0;
      |         ^~~
      |         abs
a.cc:16:13: error: request for member 'at' in 'tmp', which is of non-class type 'int'
   16 |     num[tmp.at(i)]--;
      |             ^~
a.cc:17:19: error: 'begin' was not declared in this scope
   17 |     for (auto x : num){
      |                   ^~~
a.cc:17:19: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/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:17:19: error: 'end' was not declared in this scope
   17 |     for (auto x : num){
      |                   ^~~
a.cc:17:19: 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:21:13: error: request for member 'at' in 'tmp', which is of non-class type 'int'
   21 |     num[tmp.at(i)]++;
      |             ^~
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
using namespace std;


int a[100001];
int a2[100001];


bool vis[100001];
int main(){
	int n;
	cin >> n;

	for(int i = 0; i < n; i++){
		cin >> a2[i];
		a[a2[i]]++;
	}
	long long int sum = 0;
	for(int i = 0; i < n; i++){
		if(!vis[a2[i]]){
			vis[a2[i]] = true;
			//cout << a[a2[i]] << endl;
			long long int res =  (a[a2[i]] * (a[a2[i]] - 1))/2;
			sum +=  res;
		}
	}
	
	for(int i = 0; i < n; i++){
		sum -= a[a2[i]] - 1;
		cout << tsum << endl;
      	sum += a[a2[i]] - 1;
	}



}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:25: error: 'tsum' was not declared in this scope; did you mean 'sum'?
   36 |                 cout << tsum << endl;
      |                         ^~~~
      |                         sum
Language: C++

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

long nCr(int n, int r) {//コピペ
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

int main() {
	map<int,int> A1,A2;//<整数,出現回数>,<整数,場合の数>
	
	int n;
	cin>>n;
	vector<int>K(n);
	rep(i,n){
		int a;//変数設定上大文字と小文字は区別される
		cin>>a;
		K[i]=a;
		A1[a]++;
	}
	
	
	for(auto p:A1){
		A2[p.first]=nCr(p.second,2);
	}
	
	ll sum=0;
	for(auto p:A2){
		sum+=p.second;
	}
	
	for(int i=1;i<n;i++){
		int j,sub;//仮の変数
		j=A1[k[i]]-1;
		sub=nCr(j+1,2)-nCr(j,2);
		cout<<sum-sub<<endl;
	}
	
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:22: error: 'k' was not declared in this scope
   42 |                 j=A1[k[i]]-1;
      |                      ^
Language: C++

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

long nCr(int n, int r) {//コピペ
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

int main() {
	map<int,int> A1,A2;//<整数,出現回数>,<整数,場合の数>
	
	int n;
	cin>>n;
	vector<int>K(n);
	rep(i,n){
		int a;//変数設定上大文字と小文字は区別される
		cin>>a;
		K[i]=a;
		A1[a]++;
	}
	
	
	for(auto p:A1){
		A2[p.first]=nCr(p.second,2);
	}
	
	ll sum=0;
	for(auto p:A2){
		sum+=p.second;
	}
	
	for(int i=1;i<n;i++){
		int j,sub;//仮の変数
		j=A[k[i]]-1;
		sub=nCr(j+1,2)-nCr(j,2);
		cout<<sum-sub<<endl;
	}
	
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:19: error: 'A' was not declared in this scope
   42 |                 j=A[k[i]]-1;
      |                   ^
a.cc:42:21: error: 'k' was not declared in this scope
   42 |                 j=A[k[i]]-1;
      |                     ^
Language: C++

import collections
a = int(input())
l = list(map(int, input().split()))
l_2 = collections.Counter(l)
for i in range(a):
    print(l_2[i + 1])


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import collections
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

import collections
n = int(input())
a = list(map(int, input().split()))
for k in range(n):
    a_2 = a[:k] + a[k + 1:]
    coun = collections.Counter(a_2)
    num = list(coun.values())
    num_2 = map(lambda x: (x - 1) * (2 + (x - 2)) / 2, num)
    print(int(sum(num_2)))

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import collections
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

import collections
n = int(input())
a = list(map(int, input().split()))
for k in range(n):
    a_2 = a[:k] + a[k + 1:]
    coun = collections.Counter(a_2)
    num = list(coun.values())
    num_2 = map(lambda x: (x - 1) * (2 + (x - 2)) / 2, num)
    print(int(sum(num_2)))


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import collections
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

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];

    vector<int> countnum(n,0);

    rep(i,n){
        countnum[a[i]-1]++;
    }

    ll tot = 0;

    rep(i,n) tot+=choose2(countnum[i]);

    rep(i,n){
        ll ans = tot;
        ans-=choose2(countnum[a[i]-1]);
        ans+=choose2(countnum[[a[i]-1]-1]);
        cout << ans << endl;
    }


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:30: error: two consecutive '[' shall only introduce an attribute before '[' token
   63 |         ans+=choose2(countnum[[a[i]-1]-1]);
      |                              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,a[200005],b[200005],ans;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
	     cin>>a[i],buc[a[i]]++;
	for(int i=1;i<=n;i++) ans+=buc[i]*(buc[i]-1)/2;
	for(int i=1;i<=n;i++) cout<<ans-(buc[a[i]]-1)<<endl;
	return 0;
}
//68871358
//76140264
//25446011
//200841159
//914174775

Compiler output:
a.cc: In function 'int main()':
a.cc:7:24: error: 'buc' was not declared in this scope
    7 |              cin>>a[i],buc[a[i]]++;
      |                        ^~~
a.cc:8:36: error: 'buc' was not declared in this scope
    8 |         for(int i=1;i<=n;i++) ans+=buc[i]*(buc[i]-1)/2;
      |                                    ^~~
a.cc:9:42: error: 'buc' was not declared in this scope
    9 |         for(int i=1;i<=n;i++) cout<<ans-(buc[a[i]]-1)<<endl;
      |                                          ^~~
Language: C++

#include<bits/stdc++.h>
#define REP(i, c) for (int i = 0; i < (c);i++)
using ll = long long;
using namespace std;
long long choose(int num){
  return num * (num - 1) / 2;
}
int main(){
  int N;
  cin >> N;
  vector<int> data(N);
  REP(i, N) cin >> data.at(i);
  vector<int> cnt(N);
  REP(i, N) cnt.at(data.at(i) - 1)++;
  long long int sum = 0;
  REP(i, N) sum += choose(cnt.at(i));
  REP(i, N)
  { 
    long long int ans= sum - cnt.at(data.at(i)-1) + 1
    cout << ans<< endl;
  }
}


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

#include<bits/stdc++.h>

typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++) // no semicoron
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>0;i--)
#define FORD(i,a,b) for(ll i=(a);i>(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく

using namespace std;

int factorialMethod(int k){
    ll sum = 1;
    FOR(i, 1, k+1)
    {
        sum *= i;
    }
    return sum;
}

int main(){
    ll N;
    cin >> N;
    vector<int> A (N+1);
    vector<int> B (N+1);
    vector<int> FM (N+1);


    FOR(i, 0, N+1) B[i] = 0;

    FOR(i, 1, N+1){
        cin >> A[i];
        B[A[i]]++;
    }

    //FOR(i, 0, N+1) cout << B[i] << endl;

    ll sum = 0;
    ll fm;
    ll maxb = 1;

    ll nkara;
    ll all = 0;

    FOR(i, 1, N+1){
        nkara = (ll)(B[i] - 1) * B[i] / 2);
        all += nkara;
    }

    FOR(i, 1, N+1){
        cout << all - (ll)(B[A[i]] - 1) << endl;
    }
    
    /*FOR(i, 1, N+1){
        if(maxb <= B[i]) maxb = B[i];
    }

    FOR(j, 1, maxb + 1){
        FM[j] = factorialMethod(B[j])/(2*factorialMethod(B[j] - 2));
    }

    FOR(i, 1, N+1){
        //cout << "i: " << i << endl;
        B[A[i]] --;
        FOR(j, 1, N+1){
            if(B[j] != 0){
                //cout << "j: " << j << endl;
                //cout << "B[j]: " << B[j] << endl;
                //fm = factorialMethod(B[j])/(2*factorialMethod(B[j] - 2));
                //cout << "fm: " << fm << endl;
                sum += FM[B[j]];
            }
            //ll fm = 
            
        }
        cout << sum << endl;
        B[A[i]] ++;
        sum = 0;     
    }*/



}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:42: error: expected ';' before ')' token
   48 |         nkara = (ll)(B[i] - 1) * B[i] / 2);
      |                                          ^
      |                                          ;
Language: Java

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        int size = sc.nextInt();
        int[] orig = new int[size];
        int[] cards = new int[size];
        for(int i =0; i< size; i++){
            orig[i] = sc.nextInt();
            cards[i] = orig[i];
        }
        Arrays.sort(cards);
         for(int i =0; i<size; i++){
             int x = orig[i]; // x to be excluded
             int ans = 0;
             for(int j =0; j<size; j++){
                 int occ = 1;
                 if(cards[j] == x) occ--;
                 while(j+1 < size && cards[j] == cards[j+1]){
                     occ++;
                     j++;
                 }
                 if(occ>1){
                     ans += (occ*(occ-1))/2;
                 }  
             }
             System.out.println(ans); 
         }
    }
}

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

#include <bits/stdc++.h>
 
using namespace std;
using ll=long long;
 
int main() {
    ll N;
    cin >> N;
    ll A[200000] = {};
    ll cnt[200001] = {};
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        cnt[A[i]]++;
    }
 
    ll res = 0;
    ll comb = 0;
    for (int i = 0; i < N; ++i) {
        comb += (cnt[i] * (cnt[i] - 1)) / 2;
    }
    for (int k = 0; k < N; ++k) {
        res = comb - (cnt[A[k]] - 1) *(cnt[A[k]-2)/2;
        cout << res << endl;
    }
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:50: error: expected ']' before ')' token
   22 |         res = comb - (cnt[A[k]] - 1) *(cnt[A[k]-2)/2;
      |                                                  ^
      |                                                  ]
Language: Java

import java.util.Scanner;

public class D {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];

    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    int[] cnt = new int[n];
    for (int m : a) {
      cnt[m - 1]++;
    }

    long sum = 0;
    for (int i = 0; i < n; i++) {
      if (cnt[i] < 2) {
        continue;
      }

      int tmp = cnt[i];
      sum += tmp * (tmp - 1) / 2;
    }

    for (int i = 0; i < n; i++) {
      int tmp = a[i] - 1;
      if (cnt[tmp] < 2) {
        System.out.println(sum);
      } else {
        System.out.println(sum - (cnt[tmp] - 1));
      }
    }
  }
}


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

from collections import Counter

N = int(input())
A = list(map(int,input().split()))
C = Counter(A)
D=dict()
sum_D =0
for key,val in C.items():
    r = val*(val-1)//2
    D[key] =r
    sum_D+=r

for a in A:
    cnt = C[a]
    gain= (cnt-1)*(cnt-2)//2
    less = D[a]
    print(sum_D - less + gain)


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import Counter
      | ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define ll long long

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> k(n, 0);
    rep(i, n) {
        cin >> a[i];
        k[a[i] - 1]++;
    }
    ll sum = 0;
    rep(i, n)
        {
            ll sum += (k[i] * (k[i] - 1)) / 2;
            //cout <<" ##" << sum << endl;
    }
    rep(i, n){
        ll ssum = sum;
        ssum -= k[a[i]- 1] - 1;
        cout << ssum << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:20: error: expected initializer before '+=' token
   27 |             ll sum += (k[i] * (k[i] - 1)) / 2;
      |                    ^~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define ll long long

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> k(n, 0);
    rep(i, n) {
        cin >> a[i];
        k[a[i] - 1]++;
    }
    ll sum = 0;
    rep(i, n)
        {
            ll += (k[i] * (k[i] - 1)) / 2;
            //cout <<" ##" << sum << endl;
    }
    rep(i, n){
        ll ssum = sum;
        ssum -= k[a[i]- 1] - 1;
        cout << ssum << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: expected unqualified-id before '+=' token
   27 |             ll += (k[i] * (k[i] - 1)) / 2;
      |                ^~
Language: C++

from math import factorial

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

check = set(list(a))
fac = []

cnt_list = [0] * max(a)


for i in check:
    cnt_list[int(i)-1] = a.count(int(i))

for i in cnt_list:
    if(i >= 2):
        fac.append(factorial(i)// (factorial(i-2) * factorial(2)))
    else:
        fac.append(0)
ans = []

for i in range(len(fac)):
    if(fac[i] <= 1):
        ans.append(sum(fac) - fac[i])
    else:
        ans.append(sum(fac) - fac[i] + factorial(cnt_list[i]-1) // (factorial(cnt_list[i]-3) * factorial(2)))

for i in a:
    print(ans[i-1])

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from math import factorial
      | ^~~~
Language: C++

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

int main(){
    int N;
    cin >> N;
    vector<ll> A(N),A_sorted(N);
    rep(i,N) cin >> A[i];
    rep(i,N) A_sorted[i]=A[i];
    sort(A_sorted.begin(),A_sorted.end());
    vector<ll> cnt(N+1);
    rep(i,N) cnt[A_sorted[i]]++;
    ll sum=0;
    rep2(i,1,N+1){
        sum+=cnt[i]*(cnt[i]-1)/2;
    }

    rep(k,N){
        ll num = A[k];
        ll ans=sum-(cnt[num]*(cnt[num]-1))/2+max(0,((cnt[num]-1)*(cnt[num]-2))/2);
        cout << ans << endl;        
    }
}

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

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

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        long[] a = new long[n];
        Map<Long, Long> mp = new HashMap<>();
        for(long i = 0; i < n; ++i){
            a[i] = sc.nextLong();
            long v = mp.getOrDefault(a[i], 0);
            mp.put(a[i], v+1);
        }
      
        long sum = 0;
        for(long v : mp.values()){
            sum += v * (v-1) / 2L;
        }

      for(int i = 0; i < n; ++i){
            long v = mp.get(a[i]);
            long ans = sum;
            ans -= v*(v-1)/2L;
            ans += (v-1)*(v-2)/2L;
            System.out.println(ans);
        }
    }
}


Compiler output:
Main.java:9: error: incompatible types: possible lossy conversion from long to int
        long[] a = new long[n];
                            ^
Main.java:12: error: incompatible types: possible lossy conversion from long to int
            a[i] = sc.nextLong();
              ^
Main.java:13: error: incompatible types: possible lossy conversion from long to int
            long v = mp.getOrDefault(a[i], 0);
                                       ^
Main.java:13: error: incompatible types: int cannot be converted to Long
            long v = mp.getOrDefault(a[i], 0);
                                           ^
Main.java:14: error: incompatible types: possible lossy conversion from long to int
            mp.put(a[i], v+1);
                     ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
5 errors
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'cin'
    7 |   cin >> n;
      |   ^~~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'cin'
    7 |   cin >> n;
      |   ^~~
Language: C++

import collections

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

c = collections.Counter(a)

ans = 0

for i in c.values():
    ans += i * (i - 1) // 2

for i in range(n):
    print(ans - c[a[i]] + 1)


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import collections
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

int main() {
    int N;
    cin >> N;
    long long int sum = 0;
    vector<int> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    map<long long int,long long int> num;
    for(int i = 0; i < N; i++) {
        num[A[i]] += 1;
    }
    long long res = 0;
    for(auto it : num) res += it.second * (it.second - 1) / 2;
    for(int i = 0; i < N; i++) {
        long long val = m[A[i]];
        long long before = val * (val - 1) / 2;
        long long after = (val - 1) * (val - 2) / 2;
        cout << res + after - before << endl;  
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: 'm' was not declared in this scope
   19 |         long long val = m[A[i]];
      |                         ^
Language: C++

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

int main() {
    int N;
    cin >> N;
    long long int sum = 0;
    vector<int> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    map<long long int,long long int> num;
    for(int i = 0; i < N; i++) {
        num[A[i]] += 1;
    }
    long long res = 0;
    for(auto it : num) 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;  
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: 'ma' was not declared in this scope; did you mean 'fma'?
   19 |         long long val = ma[A[i]];
      |                         ^~
      |                         fma
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[i];
    }
    map<int,int> num;
    for(int i = 0; i < N; i++) {
        num[A[i]] += 1;
    }

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'sum' was not declared in this scope; did you mean 'num'?
   17 |         sum += num[i] * (num[i] - 1) / 2;
      |         ^~~
      |         num
a.cc:21:9: error: 'sum' was not declared in this scope; did you mean 'num'?
   21 |         sum -= num[A[i]] * (num[A[i]] - 1) / 2;
      |         ^~~
      |         num
Language: C++

```
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[200005],t[200005],b[200005],sum;
signed main()
{
	int n;
	cin>>n;
	for(int i=1; i<=n; i++)scanf("%d",&a[i]),t[a[i]]++;//桶存储每个数出现次数
	for(int i=1; i<=n; i++)//枚举的是数字1~n，不是下标的1~n
		if(t[i]>1)//t[i]<=1时，对答案是没有影响的
		{
			sum+=(t[i]-1)*t[i]/2;//计算次数累加
            b[i]=t[i]-1;//去掉这个数字后答案的减少量
		}
	for(int i=1; i<=n; i++)cout<<sum-b[a[i]]<<endl; 
}
```

Compiler output:
a.cc:1:1: error: stray '`' in program
    1 | ```
      | ^
a.cc:1:2: error: stray '`' in program
    1 | ```
      |  ^
a.cc:1:3: error: stray '`' in program
    1 | ```
      |   ^
a.cc:19:1: error: stray '`' in program
   19 | ```
      | ^
a.cc:19:2: error: stray '`' in program
   19 | ```
      |  ^
a.cc:19:3: error: stray '`' in program
   19 | ```
      |   ^
Language: Java

package lesson2;
import java.util.Scanner;
public class DBannedK {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		sc.nextLine();
		String line = sc.nextLine();
		String[] balls = line.split(" ");
		String[] temp = balls;
		
		for (int i=0; i<N; i++) {
			int count = 0;
			temp = line.split(" "); //resetting temp to balls
			temp[i] = "removed";
			for(int k =0; k<N-1; k++) {
				for (int j=k+1;j<N; j++) {
					if(temp[k].equals(temp[j])) {
						count++; //checking if every combination
					}
				}
			}
			System.out.println(count);
		}
		
	}

}


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

// g++ -std=gnu++1y -O2 main.cpp

#include <cstdio>
#include <vector>
#include <set>

#include <map>
#include <unordered_map>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <climits>

using namespace std;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

long long factorial(long long n)
{
	assert(n >= 0);

	if (n == 0)
		return 1;

	long long f = 1;
	while (n != 0) {
		f *= n;
		n--;
	}
	return f;
}

long long choose2(long long n)
{
	if (n <= 1)
		return 0;

	return factorial(n) / (2 * factorial(n - 2));
}

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

	vector<long long> A(N);
	unordered_map<long long, long long> table;
	for (long long i = 0; i < N; i++)
	{
		long long Ai;
		cin >> Ai;

		A[i] = Ai;

		if (!table[Ai]) {
			table[Ai] = 0;
		}
		table[Ai]++;
	}

	long long sum = 0;
	for (unordered_map<long long, long long>::iterator itr = table.begin(); itr != table.end(); ++itr)
	{
		long long Ai = itr->first;
		long long cnt = itr->second;

		sum += choose2(cnt);
	}


	for (long long i = 0; i < N; i++) {
		long long ans = sum;
		ans -= choose2(table[A[i]]);
		ans += choose2(table[A[i]] - 1);
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'long long int factorial(long long int)':
a.cc:23:9: error: 'assert' was not declared in this scope
   23 |         assert(n >= 0);
      |         ^~~~~~
a.cc:15:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
   14 | #include <climits>
  +++ |+#include <cassert>
   15 |
Language: C++

// g++ -std=gnu++1y -O2 main.cpp

#include <cstdio>
#include <vector>
#include <set>

#include <map>
#include <unordered_map>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <climits>

using namespace std;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int factorial(int n)
{
	assert(n >= 0);

	if (n == 0)
		return 1;

	int f = 1;
	while (n != 0) {
		f *= n;
		n--;
	}
	return f;
}

int choose2(int n)
{
	if (n <= 1)
		return 0;

	return factorial(n) / (2 * factorial(n - 2));
}

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

	vector<int> A(N);
	unordered_map<int, int> table;
	for (int i = 0; i < N; i++)
	{
		int Ai;
		cin >> Ai;

		A[i] = Ai;

		if (!table[Ai]) {
			table[Ai] = 0;
		}
		table[Ai]++;
	}

	int sum = 0;
	for (unordered_map<int, int>::iterator itr = table.begin(); itr != table.end(); ++itr)
	{
		int Ai = itr->first;
		int cnt = itr->second;

		sum += choose2(cnt);
	}


	for (int i = 0; i < N; i++) {
		int ans = sum;
		ans -= choose2(table[A[i]]);
		ans += choose2(table[A[i]] - 1);
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int factorial(int)':
a.cc:23:9: error: 'assert' was not declared in this scope
   23 |         assert(n >= 0);
      |         ^~~~~~
a.cc:15:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
   14 | #include <climits>
  +++ |+#include <cassert>
   15 |
Language: C++

# test code
#include <iostream>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n;
	cin >> n;
	int a[n];
	int count[n+1]={};
	rep(i,n){
		cin>>a[i];
		count[a[i]]++;
	}
	ll ans[n+1]={};
	ll sum = 0;
	for(int i=1;i<n+1;i++){
		ll coun = count[i];
		ans[i] = coun*(coun-1)/2;
		sum+=ans[i];
	}
	for(int i=1;i<n+1;i++){
		ll coun = count[a[i-1]]-1;
		ll each = coun*(coun-1)/2;
		cout << sum - ans[a[i-1]] + each << endl;
	}
}


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #test
    1 | # test code
      |   ^~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
using namespace std;
using ll =long long;


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#define int long long

using namespace std;

int main(){
    int n, sum=0;
    cin >> n;
    vector<int> nums, table(200000, 0), diff(200000, 0);
    nums.resize(n);
    for(int i=0;i<n;i++){
        cin >> nums[i];
        table[nums[i]]++;
    }
    for(int i=0;i<n;i++){
        //cout << table[i] << endl;
        if(table[i]>=2){
            sum+=table[i]*(table[i]-1)/2;
            diff[i] = table[i]*(table[i]-1)/2-(table[i]-2)*(table[i]-1)/2;
        }
    }
    //cout << sum << endl;
    for(int i=0;i<n;i++){
        cout << sum - diff[nums[i]] << endl;
    }
}

    

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

import numpy as np
from sys import stdin
input = stdin.readline
N = int(input())
A = list(map(int, input().split()))
number = np.zeros(N, dtype = int)
total = 0
for i in range(N):
  tmp = A.count(i + 1)
  total += tmp * (tmp -1) // 2
  number[i] = tmp
for i in range(N):
  number[i] = total - number[i] + 1
for j in A:
  print(number[j-1])


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'