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

//...code_sm....

//27-03-20   20:34
include<bits/stdc++.h>
#define vi vector<int>
using namespace std;
int main()
{
int n;
cin>>n;
vi v(n);
for(int i=0;i<n;i++)
cin>>v[i];

for(int i=0;i<n;i++)
{
	map<int,int>mp;
	int s=0;
	for(int j=0;(j<n);j++)
	{
	    if(j!=i)
		mp[v[j]]++;
	}
for(auto x:mp)
s+=x.second*(x.second-1)/2;
	cout<<s<<"\n";
}
	}

Compiler output:
a.cc:4:1: error: 'include' does not name a type
    4 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:1: error: 'cin' was not declared in this scope
   10 | cin>>n;
      | ^~~
a.cc:5:12: error: 'vector' was not declared in this scope
    5 | #define vi vector<int>
      |            ^~~~~~
a.cc:11:1: note: in expansion of macro 'vi'
   11 | vi v(n);
      | ^~
a.cc:5:19: error: expected primary-expression before 'int'
    5 | #define vi vector<int>
      |                   ^~~
a.cc:11:1: note: in expansion of macro 'vi'
   11 | vi v(n);
      | ^~
a.cc:13:6: error: 'v' was not declared in this scope
   13 | cin>>v[i];
      |      ^
a.cc:17:9: error: 'map' was not declared in this scope
   17 |         map<int,int>mp;
      |         ^~~
a.cc:17:13: error: expected primary-expression before 'int'
   17 |         map<int,int>mp;
      |             ^~~
a.cc:22:17: error: 'mp' was not declared in this scope
   22 |                 mp[v[j]]++;
      |                 ^~
a.cc:22:20: error: 'v' was not declared in this scope
   22 |                 mp[v[j]]++;
      |                    ^
a.cc:24:12: error: 'mp' was not declared in this scope
   24 | for(auto x:mp)
      |            ^~
a.cc:26:9: error: 'cout' was not declared in this scope
   26 |         cout<<s<<"\n";
      |         ^~~~
Language: C++

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

int main()
{
    int N;
    cin >> N;
    vector<long long> cnt(N + 1), A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        cnt[A[i]]++;
    }
    long long maxa = *max_element(cnt.begin(), cnt.end(), 0);
    vector<long long> sigma(maxa);
    for (int  i = 0; i < sigma.size(); i++)
    {
        if (i == 0)
        {
            sigma[i] = 1;
        }
        else
        {
            sigma[i] = sigma[i - 1] + i + 1;
        }
    }
    long long sum = 0;
    for (long i = 0; i < N; i++)
    {
        sum += sigma[cnt[i] - 1];
    }

    for (int i = 0; i < N; i++)
    {
        cout << sum - sigma[cnt[A[i]] - 1] + sigma[cnt[A[i]] - 2];
        if (i == N - 1)
            cout << endl;
        else
            cout << " ";
    }
}

Compiler output:
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; _Iterator2 = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; _Compare = int]':
/usr/include/c++/14/bits/stl_algo.h:5626:12:   required from 'constexpr _ForwardIterator std::__max_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<long long int*, vector<long long int> >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<int>]'
 5626 |         if (__comp(__result, __first))
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5677:43:   required from 'constexpr _FIter std::max_element(_FIter, _FIter, _Compare) [with _FIter = __gnu_cxx::__normal_iterator<long long int*, vector<long long int> >; _Compare = int]'
 5677 |       return _GLIBCXX_STD_A::__max_element(__first, __last,
      |                                           ^
a.cc:16:34:   required from here
   16 |     long long maxa = *max_element(cnt.begin(), cnt.end(), 0);
      |                       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:158:30: error: expression cannot be used as a function
  158 |         { return bool(_M_comp(*__it1, *__it2)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>

using namespace std;

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


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

  int inp[n];
  int tracker[n + 1];

  for (int i = 0; i < n + 1; i++) {
    tracker[i] = 0;
  }

  for (int i = 0; i < n; i++) {
    int temp = 0;
    cin >> temp;
    inp[i] = temp;
    tracker[temp] += 1;
  }
  long int ans = 0;
  for (int j = 0; j < n + 1; j ++) {
    if (tracker[j] >= 2) {
      ans += nCr(tracker[j]);
    }
  }

  for (int i = 0; i < n; i++) {
    long int tempAns = 0;
    int num = inp[i];
    tempAns = ans - (tracker[num] - 1);
    // if (tracker[num] >= 2) {
    //   int p1 = nCr(tracker[num], 2);
    //   if (tracker[num] - 1 >= 2) {
    //     int p2 = nCr(tracker[num] - 1, 2);
    //     int diff = p1 - p2;
    //     tempAns = ans - diff;
    //   } else {
    //     tempAns = ans - p1;
    //   }
    // } else {
    //   tempAns = ans;
    // }

    cout << tempAns << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'long int nCr(int)':
a.cc:6:28: error: expected ';' before '}' token
    6 |    return (n * (n - 1)) / 2
      |                            ^
      |                            ;
    7 | }
      | ~
Language: C++

#include <iostream>

using namespace std;

int cal_n(int n){
   int temp = 1;
   for (int i = 2; i <= n; i++)
      temp = temp * i;
   return temp;
}

int nCr(int n, int r){
   return cal_n(n) / (cal_n(r) * cal_n(n - r));
}


int main() {

  int n;
  cin>>n;

  int inp[n];
  int tracker[n + 1];

  for (int i = 0; i < n + 1; i++) {
    tracker[i] = 0;
  }

  for (int i = 0; i < n; i++) {
    int temp = 0;
    cin >> temp;
    inp[i] = temp;
    tracker[temp] += 1;
  }
  for (int j = 0; j < n + 1; j ++) {
    cout << tracker[j] << " ";
    if (tracker[j] >= 2) {
      ans += nCr(tracker[j], 2);
    }
  }

  for (int i = 0; i < n; i++) {
    int tempAns = 0;
    int num = inp[i];
    int p1 = nCr(tracker[num], 2);
    if (tracker[num] - 1 >= 2) {
      int p2 = nCr(tracker[num] - 1, 2);
      int diff = p1 - p2;
      tempAns = ans - diff;
    } else {
      tempAns = ans - p1;
    }
    cout << tempAns << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   38 |       ans += nCr(tracker[j], 2);
      |       ^~~
      |       abs
a.cc:49:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   49 |       tempAns = ans - diff;
      |                 ^~~
      |                 abs
a.cc:51:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   51 |       tempAns = ans - p1;
      |                 ^~~
      |                 abs
Language: C++

#include <iostream>
#include <vector>
#include <map>
using namespace std;
vector<long long>v;
 
int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	long long tmp;
 
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>tmp;
		v.push_back(tmp);
	}
	map<long long,long long>p;
	for(int j=0;j<n;j++){
		if(p.count(v[j])==0){
			p.insert({v[j],1});
		}else if(p[v[j]] != 0){
			p[v[j]]++;
		}
	}
	long long sum = 0;
	for(auto it : p){
		sum += (it.second * (it.second-1))/2;
	}
	for(int i=0;i<n;i++){
		cout << sum - (p[v[i]]-1)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: 'n' was not declared in this scope
   12 |         cin>>n;
      |              ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
using namespace std;
vector<long long>v;
 
int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	long long,tmp;
 
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>tmp;
		v.push_back(tmp);
	}
	map<long long,long long>p;
	for(int j=0;j<n;j++){
		if(p.count(v[j])==0){
			p.insert({v[j],1});
		}else if(p[v[j]] != 0){
			p[v[j]]++;
		}
	}
	long long sum = 0;
	for(auto it : p){
		sum += (it.second * (it.second-1))/2;
	}
	for(int i=0;i<n;i++){
		cout << sum - (p[v[i]]-1)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: expected unqualified-id before ',' token
   10 |         long long,tmp;
      |                  ^
a.cc:12:14: error: 'n' was not declared in this scope
   12 |         cin>>n;
      |              ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <tuple>
#include <numeric>
#include <iomanip>

using namespace std;

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

    long long memo[200000+1] = {0}; // 個数を記録
    for(int i=0; i<n; ++i) memo[a[i]]++;

    long long all_count = 0;
    for(int i=0; i<n; ++i){
        all_count += memo[i]*(memo[i]-1)/2;
    }
    
    for(int i=0; i<n; ++i){
        cout << all_count - (memo[a[i]])*(memo[a[i]]-1)/2 + (memo[a[i]]-1)*(memo[a[i]]-2)/2; << endl;
    }
    
    return 0;
}

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

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

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

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

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

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  
  vector<int> kosu(200005);
  rep(i,n) kosu[a[i]]++;
  
  int kumi = 0;
  rep(i,200005){
    kumi += kosu[i]*(kosu[i]-1)/2;
  }
  
  rep(i,n){
    int ans = kumi -kosu[a[i]]+1;
    cout << ans << endl;
  }
}


Compiler output:
a.cc:30:5: error: redefinition of 'int main()'
   30 | int main(){
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main(){
      |     ^~~~
a.cc:54:5: error: redefinition of 'int main()'
   54 | int main(){
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main(){
      |     ^~~~
a.cc:78:5: error: redefinition of 'int main()'
   78 | int main(){
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main(){
      |     ^~~~
Language: C++

#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   ll n;
   cin >> n;
   vector<int> a(n + 1);
   vector<ll> s(n + 1);
   vector<ll> cmb(n + 1);

   FOR(i, 1, n + 1)
   {
      cin >> a[i];
      s[a[i]]++;
   }
   FOR(i, 1, n + 1)
   {
      acc+= s[i] * (s[i] - 1LL) / 2LL;
   }
   // ll acc = accumulate(cmb.begin()+1, cmb.end(), 0);
   FOR(i, 1, n + 1)
   {
      // cout << (acc - s[a[i]] + 1LL) << endl;
      printf("%lld\n", acc - s[a[i]] + 1LL);
   }
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:7: error: 'acc' was not declared in this scope; did you mean 'acct'?
   30 |       acc+= s[i] * (s[i] - 1LL) / 2LL;
      |       ^~~
      |       acct
a.cc:36:24: error: 'acc' was not declared in this scope; did you mean 'acct'?
   36 |       printf("%lld\n", acc - s[a[i]] + 1LL);
      |                        ^~~
      |                        acct
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//Random r = new Random();
		int N = sc.nextInt();
		int S[] = new int[N];
		int ct1[] = new int[200000];
		int ct2[] = new int[200000];
		int tmp;
		for(int i =0;i!=N;i++) {
			tmp=sc.nextInt();//sc.nextInt();
			S[i]=tmp;
			ct1[tmp]++;
			ct2[tmp]++;
			//System.out.println("tmp"+tmp+"ct"+ct1[tmp]+"ct2"+ct2[tmp]);
		}
		int total=0;
		for(int i= 0;i!=N;i++) {
			total=total+bikkuri(ct1[S[i]]);
			ct1[S[i]]=1;
		//	System.out.println(total);
		}
		for(int i=0;i!=N;i++) {
			System.out.println(total-bikkuri(ct2[S[i]])+bikkuri(ct2[S[i]]-1));
		}
	}

Compiler output:
Main.java:30: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

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

int main(){
    int N;
    cin >> N;
    vector<int64_t> A(N);
    vector<int64_t> count(N, 0);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
        count.at(A.at(i)-1)++;
    }

    int64_t sum = 0;
    for (int i = 0; i < N; i++) {
        int c = count.at(i);
        sum += c*(c-1)/2;
    }

    for (int i = 0; i < N; i++) {
        cout << sum - max(count.at(A.at(i)-1)-1, 0) << endl;
    }
} 

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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pie acos(-1)
#define loop(i,a,n) for(int i=a;i<n;i++)
#define trav(a,x) for(auto &a:x)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define w 100005

void solve()
{
    int n;
    cin>>n;
    vi a(n);
    map<int,int>m;
    loop(i,0,n)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    set<int>dum;
    ll ans=0;
    for(auto i:a)
    {
        if(dum.count(i)==0)
        {
            int p=m[i];
            ll temp=p*(p-1)/2;
            ans+=temp;
        }
        dum.insert(i);
    }
    for(int i=0;i<n;i++)
    {
        int y=m[a[i]];
        if(y>=2)
        cout<<ans-y*(y-1)/2+(y-1)*(y-2)/2<<endl;
        else
        cout<<ans<<ednl;
    }
    
}
int main() {
	// your code goes here
	io;
	int t ;
	//cin>>t;
	//while(t--)
    solve();
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:51:20: error: 'ednl' was not declared in this scope; did you mean 'endl'?
   51 |         cout<<ans<<ednl;
      |                    ^~~~
      |                    endl
Language: C++

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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

typedef pair<int, int> pi;
typedef pair<ll,ll> pl; 
typedef pair<ld,ld> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 1000001;

ll N;
map<ll, int> cnts;
ll ans;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin >> N;
	vl a(N); 
	F0R(i, N) {
		cin >> a[i];
		cnts[a[i]]++;
	}
	
	trav(i, cnts) {
		ans += i.s * (i.s - 1) / 2;
	}
	
	F0R(i, N) {
		ll tempAns = ans;
		tempAns -= cnts[a[i]] * (cnts[a[i]] - 1) / 2;
		tempAns += (cnts[a[i]] - 1) * (cnts[a[i]] - 2) / 2;
		cout << tempAns << "\n";
	}
    return 0;a
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Compiler output:
a.cc: In function 'int main()':
a.cc:64:15: error: expected ';' before '}' token
   64 |     return 0;a
      |               ^
      |               ;
   65 |     // You should actually read the stuff at the bottom
   66 | }
      | ~
Language: C++

// 比较好的方法
#include<iostream>
using namespace std;
#define MAXN 200005

int n, a[MAXN];
long long cnt[MAXN];

int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        cnt[a[i]]++;        		// 统计每个输入出现个数
    }
    long long total=0;
    for(int i=1;i<=n;i++)
        total+=cnt[i]*(cnt[i]-1)/2; // 总共可能出现的组合数
    for(int i=1;i<=n;i++){
        long long cur=cnt[a[i]];    // 当前输入的个数
        // 这句很棒，不需要进行复杂循环，直接计算结果
        // ans=total-cur能产生的组合数+cur去掉当前这个后实际产生的组合数
        long long ans=tot-cur*(cur-1)/2+(cur-1)*(cur-2)/2;
        printf("%lld\n",ans);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:23: error: 'tot' was not declared in this scope; did you mean 'total'?
   22 |         long long ans=tot-cur*(cur-1)/2+(cur-1)*(cur-2)/2;
      |                       ^~~
      |                       total
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0; i<n; i++) cin >> a.at(i);
  
  vector<long long> cnt(n+1);
  for (int i=0; i<n; i++) {
    cnt.at(a.at(i))++;
  }
  
  ll res = 0;
  for (int i=1; i<n+1; i++) res += cnt.at(i) * (cnt.at(i) - 1) / 2;
  
  for (int i=0; i<n; i++) {
    cout << res - cnt.at(a.at(i)) + 1 << endl;
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'll' was not declared in this scope
   16 |   ll res = 0;
      |   ^~
a.cc:17:29: error: 'res' was not declared in this scope
   17 |   for (int i=1; i<n+1; i++) res += cnt.at(i) * (cnt.at(i) - 1) / 2;
      |                             ^~~
a.cc:20:13: error: 'res' was not declared in this scope
   20 |     cout << res - cnt.at(a.at(i)) + 1 << endl;
      |             ^~~
Language: C++

#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <string>

int main()
{
  long n;
  std::cin >> n;

  std::unordered_map<long,long> map;

  std::vector<long> v;
  for (long i = 0; i < n; i++) {
    long val;
    std::cin >> val;
    v.push_back(val);
    auto search = map.find(val);
    if (search != map.end()) search->second += 1;
    else map[val] = 1;
  }

  std::unordered_map<long,long> answers;

  long total = 0;
  for (auto it : map) {
    total += (it.second-1) * it.second / 2;
  }

  for (auto it : map) {
    long v = it.first;
    answers[v] = total - (it.second - 1);
  }

  for (long i = 0; i < n; i++) {
    prlongf("%ld\n", answers[v[i]]);
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:5: error: 'prlongf' was not declared in this scope; did you mean 'ulong'?
   42 |     prlongf("%ld\n", answers[v[i]]);
      |     ^~~~~~~
      |     ulong
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll=long long;
ll choose2(ll n){
	return n*(n-1)/2;//nCk
} 
int main(){
  int n;
  cin>>n;
  vector<int> a(n); //可変長配列の宣言
  rep(i,n) cin>>a[i];
  rep(i,n) a[i]--;
  vector<int> cnt(n);//vectorにいれた配列の数え上げ
  rep(i,n) cnt[a[i]]++;
  ll total=0;
  rep(i,n){
    total+= choose2(cnt[i]);
  }
  rep(i,n){
  ll ans=total;
    ans-= choose2(cnt[a[i]]);
    ans+= choose2(cnt[a[i]-1]);
  }
  

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

#include<bits/stdc++.h>

using namespace std;


int main() {

    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    int n,tmp;

    cin>>n;

    vector<int>v(n);

    vector<logn long>freq(n+1,0);

    for(int i=0;i<n;i++){
        cin>>v[i];
    }

    for(int i=0;i<n;i++){
        freq[v[i]]++;
    }

    long long totalComb = 0;
   // vector<long long> combination(n);

    for(int i=1;i<n;i++){
        //combination[i] = ;
        //totalComb += combination[i];

        totalComb += (freq[i] * (freq[i]-1))/2;
    }


    long long ans = 0;

    for(int i=0;i<n;i++){
        ans = totalComb - ((freq[v[i]] * (freq[v[i]]-1))/2);
        ans += (((freq[v[i]]-1) * (freq[v[i]]-2))/2);
        cout<<ans<<endl;
    }




    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'logn' was not declared in this scope; did you mean 'long'?
   17 |     vector<logn long>freq(n+1,0);
      |            ^~~~
      |            long
a.cc:17:21: error: template argument 1 is invalid
   17 |     vector<logn long>freq(n+1,0);
      |                     ^
a.cc:17:21: error: template argument 2 is invalid
a.cc:17:32: error: expression list treated as compound expression in initializer [-fpermissive]
   17 |     vector<logn long>freq(n+1,0);
      |                                ^
a.cc:24:13: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   24 |         freq[v[i]]++;
      |             ^
a.cc:34:27: error: invalid types 'int[int]' for array subscript
   34 |         totalComb += (freq[i] * (freq[i]-1))/2;
      |                           ^
a.cc:34:38: error: invalid types 'int[int]' for array subscript
   34 |         totalComb += (freq[i] * (freq[i]-1))/2;
      |                                      ^
a.cc:41:33: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   41 |         ans = totalComb - ((freq[v[i]] * (freq[v[i]]-1))/2);
      |                                 ^
a.cc:41:47: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   41 |         ans = totalComb - ((freq[v[i]] * (freq[v[i]]-1))/2);
      |                                               ^
a.cc:42:23: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   42 |         ans += (((freq[v[i]]-1) * (freq[v[i]]-2))/2);
      |                       ^
a.cc:42:40: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   42 |         ans += (((freq[v[i]]-1) * (freq[v[i]]-2))/2);
      |                                        ^
Language: C++

#include <iostream>
//#include<cstring>
//#include <iomanip>

using namespace std;

int combination(int a)
{
  int ans;
  ans=a*(a-1)/2;
  return ans;
}

int main()
{
  int N,i,j,memory;
  float all,count,ans;
  cin>>N;
  int A[N];
  int B[N]={};
 
  //配列に格納，その数字を覚えてBに数を入力
  for(i=0;i<N;i++)
  {
    cin>>A[i];
    memory=A[i];
    B[memory-1]++;
  }

  all=0;
  for(i=0;i<N;i++)
  {
    count=combination(B[i]);
    all+=count;
  }
  cout<<all<<"\n\n";//引かない場合
  
  for(i=0;i<N;i++)
  {
    count=A[i];
    ans=combination(B[count-1]);
    cout<<ans-1<<" "<<all+1-B[count-1]<<"\n";
  }   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:22: error: invalid types 'int [N][float]' for array subscript
   41 |     ans=combination(B[count-1]);
      |                      ^
a.cc:42:30: error: invalid types 'int [N][float]' for array subscript
   42 |     cout<<ans-1<<" "<<all+1-B[count-1]<<"\n";
      |                              ^
Language: C++

#include <iostream>
//#include<cstring>
//#include <iomanip>

using namespace std;

int combination(int a)
{
  int ans;
  ans=a*(a-1)/2;
  return ans;
}

int main()
{
  int N,i,j,count,ans,memory;
  float ans;
  cin>>N;
  int A[N];
  int B[N]={};
 
  //配列に格納，その数字を覚えてBに数を入力
  for(i=0;i<N;i++)
  {
    cin>>A[i];
    memory=A[i];
    B[memory-1]++;
  }

  all=0;
  for(i=0;i<N;i++)
  {
    count=combination(B[i]);
    all+=count;
  }
 // cout<<all<<"\n\n";//引かない場合
  
  for(i=0;i<N;i++)
  {
    count=A[i];
    cout<<all+1-B[count-1]<<"\n";
  }   

}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: conflicting declaration 'float ans'
   17 |   float ans;
      |         ^~~
a.cc:16:19: note: previous declaration as 'int ans'
   16 |   int N,i,j,count,ans,memory;
      |                   ^~~
a.cc:30:3: error: 'all' was not declared in this scope
   30 |   all=0;
      |   ^~~
Language: C++

#include <iostream>
using namespace std;

long calcFactorial(long n){
  long i = 2, result = 1;
  
  while(i <= n){
    result = result * i;
    i++;
  }
  
  return result;
}

int main(void){
  const long N = 2*pow(10, 5);
  long l, m, i=0, a[N];
  long x, y;
  long num, i_num, list_num=0;
  long a_num[N] = {0}, a_list[N] = {0}, result[N] = {0}, nc2[N] = {0};
  
  cin >> num;
  while(cin>>l){
    a[i] = l;
    a_num[l]++;
    if(a_num[l] == 1){
      a_list[list_num] = l;
      list_num++;
    }
    i++;
  }

  for(x = 0;x < num;x++){
    int check[N] = {0};
    l = a[x];
    if(result[l] == 0){
      for(y = 0;y < num;y++){
        m = a[y];
        if(check[m] == 0){
          check[m] = 1;
          if(m == l){
            if(nc2[a_num[m]-1] == 0){
              nc2[a_num[m]-1] = calcFactorial(a_num[m]-1) / 2 / calcFactorial(a_num[m] - 3);
            }
            result[l] += nc2[a_num[m]-1];
          } else {
            if(nc2[a_num[m]] == 0){
              nc2[a_num[m]] = calcFactorial(a_num[m]) / 2 / calcFactorial(a_num[m] - 2);
            }
            result[l] += nc2[a_num[m]];
          }
        }
      }
    }
    cout << result[l] << "\n";
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'pow' was not declared in this scope
   16 |   const long N = 2*pow(10, 5);
      |                    ^~~
a.cc:17:21: error: size of array 'a' is not an integral constant-expression
   17 |   long l, m, i=0, a[N];
      |                     ^
a.cc:20:14: error: size of array 'a_num' is not an integral constant-expression
   20 |   long a_num[N] = {0}, a_list[N] = {0}, result[N] = {0}, nc2[N] = {0};
      |              ^
a.cc:20:31: error: size of array 'a_list' is not an integral constant-expression
   20 |   long a_num[N] = {0}, a_list[N] = {0}, result[N] = {0}, nc2[N] = {0};
      |                               ^
a.cc:20:48: error: size of array 'result' is not an integral constant-expression
   20 |   long a_num[N] = {0}, a_list[N] = {0}, result[N] = {0}, nc2[N] = {0};
      |                                                ^
a.cc:20:62: error: size of array 'nc2' is not an integral constant-expression
   20 |   long a_num[N] = {0}, a_list[N] = {0}, result[N] = {0}, nc2[N] = {0};
      |                                                              ^
a.cc:34:15: error: size of array 'check' is not an integral constant-expression
   34 |     int check[N] = {0};
      |               ^
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) {
  return n*(n-1)/2;
}
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) a[i]--;
  vector<int> cnt(n);
  rep(i,n) cnt[a[i]]++;
  ll 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;
}
#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) {
  return n*(n-1)/2;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) a[i]--;
  vector<int> cnt(n);
  rep(i,n) cnt[a[i]]++;
  ll 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:37:4: error: redefinition of 'll choose2(ll)'
   37 | ll choose2(ll n) {
      |    ^~~~~~~
a.cc:7:4: note: 'll choose2(ll)' previously defined here
    7 | ll choose2(ll n) {
      |    ^~~~~~~
a.cc:41:5: error: redefinition of 'int main()'
   41 | int main() {
      |     ^~~~
a.cc:11:5: note: 'int main()' previously defined here
   11 | int main() {
      |     ^~~~
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) {
  return n*(n-1)/2;
}
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> cnt(n);
  rep(i,n) cnt[a[i]]++;
  ll 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;
}
#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) {
  return n*(n-1)/2;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) a[i]--;
  vector<int> cnt(n);
  rep(i,n) cnt[a[i]]++;
  ll 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:36:4: error: redefinition of 'll choose2(ll)'
   36 | ll choose2(ll n) {
      |    ^~~~~~~
a.cc:7:4: note: 'll choose2(ll)' previously defined here
    7 | ll choose2(ll n) {
      |    ^~~~~~~
a.cc:40:5: error: redefinition of 'int main()'
   40 | int main() {
      |     ^~~~
a.cc:11:5: note: 'int main()' previously defined here
   11 | int main() {
      |     ^~~~
a.cc:60:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   60 | 提出情報
      | ^~~~~~~~
Language: C++

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

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x;
        x = x*x;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b];
    return tmp * fac[a];
}

int main() {
    int n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];

    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<300000; i++){
        fac[i+1] = fac[i]*(i+1); // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2); // k!^{M-2} (mod M) ←累乗にmpowを採用
    }

    vector<int> same(n, 0);
    rep(i, n){
        same[a[i]-1]++;
    }
    // for(const auto& u: same){
    //     cout << u << endl;
    // }

    ll all = 0;
    rep(i, n){
        if(same[i] > 1) all += comb(same[i], 2); 
    }

    rep(i, n){
        ll ans = all - same[a[i]-1] + 1;
        cout << ans << " ";
    }


}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:39: error: 'M' was not declared in this scope
   38 |         ifac[i+1] = ifac[i]*mpow(i+1, M-2); // k!^{M-2} (mod M) ←累乗にmpowを採用
      |                                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define int long long

typedef long long ll;


const ll mod = 998244353;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    map<int, int> m;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        m[a[i]]++;
    }
    ll ans = 0;
    for(pair<int, int> t : m){
        ans += t.second * (t.second - 1) / 2;
    }
    for(int i = 0; i < n; ++i){
        ll res = ans;
        res -= (m[a[i]] - 1) * m[a[i]] / 2;
        m[a[i]]--;
        res += (m[a[i]] - 1) * m[a[i]] / 2;
        cout << res << endl;
        m[a[i]]++;
    }
}


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

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

using P = pair<int,int>;

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

int main(){
	int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) a[i]--;
    vector<int> cnt(n);
    rep(i,n) cnt[a[i]]++;
    long long tit = 0;
    rep(i,n){
    	long long ans =tot;
        ans-=chose2(cnt[a[i]]);
        ans+=chose2(cnt[a[i]]-1);
        cout << ans << endl;
   }
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:24: error: 'tot' was not declared in this scope; did you mean 'tit'?
   21 |         long long ans =tot;
      |                        ^~~
      |                        tit
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 chose2(ll n){
	return n*(n-1)/2;
}

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


Compiler output:
a.cc:4:12: error: 'Long' does not name a type; did you mean 'long'?
    4 | using ll = Long Long;
      |            ^~~~
      |            long
a.cc:7:1: error: 'll' does not name a type
    7 | ll chose2(ll n){
      | ^~
a.cc: In function 'int main()':
a.cc:19:5: error: 'll' was not declared in this scope
   19 |     ll tit = 0;
      |     ^~
a.cc:21:11: error: expected ';' before 'ans'
   21 |         ll ans =tot;
      |           ^~~~
      |           ;
a.cc:22:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |         ans-=chose2(cnt[a[i]]);
      |         ^~~
      |         abs
a.cc:22:14: error: 'chose2' was not declared in this scope; did you mean 'close'?
   22 |         ans-=chose2(cnt[a[i]]);
      |              ^~~~~~
      |              close
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 chose2(ll n){
	return n*(n-1)/2;
}

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

Compiler output:
a.cc:4:12: error: 'Long' does not name a type; did you mean 'long'?
    4 | using ll = Long Long;
      |            ^~~~
      |            long
a.cc:5:24: error: expected ';' before 'll'
    5 | using P = pair<int,int>
      |                        ^
      |                        ;
    6 | 
    7 | ll chose2(ll n){
      | ~~                      
a.cc: In function 'int main()':
a.cc:19:5: error: 'll' was not declared in this scope
   19 |     ll tit = 0;
      |     ^~
a.cc:21:11: error: expected ';' before 'ans'
   21 |         ll ans =tot;
      |           ^~~~
      |           ;
a.cc:22:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |         ans-=chose2(cnt[a[i]]);
      |         ^~~
      |         abs
a.cc:22:14: error: 'chose2' was not declared in this scope; did you mean 'close'?
   22 |         ans-=chose2(cnt[a[i]]);
      |              ^~~~~~
      |              close
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long [] in = new long [a];
        long [] in2 = new long [a];
        long b = 0;
        long c;
        for(int i=0;i<a;i++){in[i] = sc.nextLong();
                             in2[in[i]-1]++;
                            }
        for(int i=0;i<a;i++){b+=in2[i]*(in2[i]-1)/2;                                                 
                            }
        for(int i=0;i<a;i++){c = in2[in[i]-1];
                             System.out.println(b-c+1);
                            }	
	}
}


Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
                             in2[in[i]-1]++;
                                      ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
        for(int i=0;i<a;i++){c = in2[in[i]-1];
                                          ^
2 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long [] in = new long [a];
        long [] in2 = new long [a];
        long b = 0;
        long c;
        for(int i=0;i<a;i++){in[i] = sc.nextlong();
                             in2[in[i]-1]++;
                            }
        for(int i=0;i<a;i++){b+=in2[i]*(in2[i]-1)/2;                                                 
                            }
        for(int i=0;i<a;i++){c = in2[in[i]-1];
                             System.out.println(b-c+1);
                            }	
	}
}


Compiler output:
Main.java:10: error: cannot find symbol
        for(int i=0;i<a;i++){in[i] = sc.nextlong();
                                       ^
  symbol:   method nextlong()
  location: variable sc of type Scanner
Main.java:11: error: incompatible types: possible lossy conversion from long to int
                             in2[in[i]-1]++;
                                      ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
        for(int i=0;i<a;i++){c = in2[in[i]-1];
                                          ^
3 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long [] in = new long [a];
        long [] in2 = new long [a];
        long b = 0;
      　long c;
        for(int i=0;i<a;i++){in[i] = sc.nextlong();
                             in2[in[i]-1]++;
                            }
        for(int i=0;i<a;i++){b+=in2[i]*(in2[i]-1)/2;                                                 
                            }
        for(int i=0;i<a;i++){c = in2[in[i]-1];
                             System.out.println(b-c+1);
                            }	
	}
}


Compiler output:
Main.java:9: error: illegal character: '\u3000'
      ?long c;
      ^
1 error
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ll long long
#define MOD 1000000007
#define MAX 200010
#define test(a,n) REP(i,n) cout << a[i] << " "; cout << endl;
using namespace std;

signed main(){
  int a;
  cin>>a;
  vector<int> b(a);
  rep(i,a)
    cin>>b[i];
  vector<int> c(200010,0);
  rep(i,a){
  c[b[i]-1]++;
  }
  int d=0;
  rep(i,200010){
  d+=c[i]*(c[i]-1)/2;
  }
  rep(i,a){
    cout<<d-c[b[i]-1]+1<<endl;
  }
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   rep(i,a)
      |       ^
a.cc:15:3: error: 'rep' was not declared in this scope
   15 |   rep(i,a)
      |   ^~~
Language: C++

#include<stdio.h>
#include<string.h>
#include<iostream>
void quicksort(int a[][3], int l, int h)
{
    int mid=a[(l+h)/2][0];
    int i=l,j=h;
    int t;
    while(i<=j)
    {
    	while(a[i][0]<mid&&i<h) i++;
        while(a[j][0]>mid&&j>0) j--;
        if(i<=j)
        {
            t=a[i][0];
			a[i][0]=a[j][0];
			a[j][0]=t;
			t=a[i][1];
			a[i][1]=a[j][1];
			a[j][1]=t;
            i++;
            j--;
        }
	}
    if(l<j) quicksort(a,l,j);
    if(i<h) quicksort(a,i,h);
}
void quicksort1(int a[][3], int l, int h)
{
    int mid=a[(l+h)/2][1];
    int i=l,j=h;
    int t;
    while(i<=j)
    {
    	while(a[i][1]<mid&&i<h) i++;
        while(a[j][1]>mid&&j>0) j--;
        if(i<=j)
        {
            t=a[i][2];
			a[i][2]=a[j][2];
			a[j][2]=t;
			t=a[i][1];
			a[i][1]=a[j][1];
			a[j][1]=t;
            i++;
            j--;
        }
	}
    if(l<j) quicksort1(a,l,j);
    if(i<h) quicksort1(a,i,h);
}
int main()
{
	int n,i,a[200000][3]={0},j=1,k=0;
    __int64  s=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i][0]);
		a[i][1]=i;
	}
	quicksort(a,0,n-1);
	for(i=n-2;i>=0;i--)
	{
		if(a[i][0]==a[i+1][0])
		j++;
		else
		{
			s+=j*(j-1)/2;
			for(k=i+1;k<i+1+j;k++)
			a[k][2]=j;
			j=1;
		}
	}
	if(a[0][0]==a[1][0])
	{
		s+=j*(j-1)/2;
		for(k=0;k<j;k++)
		a[k][2]=j;
	}
	else
	a[0][2]=1;
	quicksort1(a,0,n-1);
	for(i=0;i<n;i++)
	{
		std::cout<<s-a[i][2]+1<<"\n";
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   55 |     __int64  s=0;
      |     ^~~~~~~
      |     __int64_t
a.cc:69:25: error: 's' was not declared in this scope
   69 |                         s+=j*(j-1)/2;
      |                         ^
a.cc:77:17: error: 's' was not declared in this scope
   77 |                 s+=j*(j-1)/2;
      |                 ^
a.cc:86:28: error: 's' was not declared in this scope
   86 |                 std::cout<<s-a[i][2]+1<<"\n";
      |                            ^
Language: C++

#include<stdio.h>
#include<string.h>
void quicksort(int a[][3], int l, int h)
{
    int mid=a[(l+h)/2][0];
    int i=l,j=h;
    int t;
    while(i<=j)
    {
    	while(a[i][0]<mid&&i<h) i++;
        while(a[j][0]>mid&&j>0) j--;
        if(i<=j)
        {
            t=a[i][0];
			a[i][0]=a[j][0];
			a[j][0]=t;
			t=a[i][1];
			a[i][1]=a[j][1];
			a[j][1]=t;
            i++;
            j--;
        }
	}
    if(l<j) quicksort(a,l,j);
    if(i<h) quicksort(a,i,h);
}
void quicksort1(int a[][3], int l, int h)
{
    int mid=a[(l+h)/2][1];
    int i=l,j=h;
    int t;
    while(i<=j)
    {
    	while(a[i][1]<mid&&i<h) i++;
        while(a[j][1]>mid&&j>0) j--;
        if(i<=j)
        {
            t=a[i][2];
			a[i][2]=a[j][2];
			a[j][2]=t;
			t=a[i][1];
			a[i][1]=a[j][1];
			a[j][1]=t;
            i++;
            j--;
        }
	}
    if(l<j) quicksort1(a,l,j);
    if(i<h) quicksort1(a,i,h);
}
int main()
{
	int n,i,a[200000][3]={0},j=1,k=0;
    __int64 s=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i][0]);
		a[i][1]=i;
	}
	quicksort(a,0,n-1);
	for(i=n-2;i>=0;i--)
	{
		if(a[i][0]==a[i+1][0])
		j++;
		else
		{
			s+=j*(j-1)/2;
			for(k=i+1;k<i+1+j;k++)
			a[k][2]=j;
			j=1;
		}
	}
	if(a[0][0]==a[1][0])
	{
		s+=j*(j-1)/2;
		for(k=0;k<j;k++)
		a[k][2]=j;
	}
	else
	a[0][2]=1;
	quicksort1(a,0,n-1);
	for(i=0;i<n;i++)
	{
		printf("%I64d\n",s-a[i][2]+1);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   54 |     __int64 s=0;
      |     ^~~~~~~
      |     __int64_t
a.cc:68:25: error: 's' was not declared in this scope
   68 |                         s+=j*(j-1)/2;
      |                         ^
a.cc:76:17: error: 's' was not declared in this scope
   76 |                 s+=j*(j-1)/2;
      |                 ^
a.cc:85:34: error: 's' was not declared in this scope
   85 |                 printf("%I64d\n",s-a[i][2]+1);
      |                                  ^
Language: C

#include<stdio.h>
#include<string.h>
void quicksort(int a[][3], int l, int h)
{
    int mid=a[(l+h)/2][0];
    int i=l,j=h;
    int t;
    while(i<=j)
    {
    	while(a[i][0]<mid&&i<h) i++;
        while(a[j][0]>mid&&j>0) j--;
        if(i<=j)
        {
            t=a[i][0];
			a[i][0]=a[j][0];
			a[j][0]=t;
			t=a[i][1];
			a[i][1]=a[j][1];
			a[j][1]=t;
            i++;
            j--;
        }
	}
    if(l<j) quicksort(a,l,j);
    if(i<h) quicksort(a,i,h);
}
void quicksort1(int a[][3], int l, int h)
{
    int mid=a[(l+h)/2][1];
    int i=l,j=h;
    int t;
    while(i<=j)
    {
    	while(a[i][1]<mid&&i<h) i++;
        while(a[j][1]>mid&&j>0) j--;
        if(i<=j)
        {
            t=a[i][2];
			a[i][2]=a[j][2];
			a[j][2]=t;
			t=a[i][1];
			a[i][1]=a[j][1];
			a[j][1]=t;
            i++;
            j--;
        }
	}
    if(l<j) quicksort1(a,l,j);
    if(i<h) quicksort1(a,i,h);
}
int main()
{
	int n,i,a[200000][3]={0},j=1,k=0;
    __int64 s=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i][0]);
		a[i][1]=i;
	}
	quicksort(a,0,n-1);
	for(i=n-2;i>=0;i--)
	{
		if(a[i][0]==a[i+1][0])
		j++;
		else
		{
			s+=j*(j-1)/2;
			for(k=i+1;k<i+1+j;k++)
			a[k][2]=j;
			j=1;
		}
	}
	if(a[0][0]==a[1][0])
	{
		s+=j*(j-1)/2;
		for(k=0;k<j;k++)
		a[k][2]=j;
	}
	else
	a[0][2]=1;
	quicksort1(a,0,n-1);
	for(i=0;i<n;i++)
	{
		printf("%I64d\n",s-a[i][2]+1);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:54:5: error: unknown type name '__int64'; did you mean '__int64_t'?
   54 |     __int64 s=0;
      |     ^~~~~~~
      |     __int64_t