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

#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    map<int, ll> cnt; // a[i]の出現回数

    rep(i, n) {
        cin >> a[i];
        cnt[a[i]]++;
    }

    ll total = 0;
    map<int, ll> ss;
    for (auto e: cnt) {
        ss[e.first] = e.second * (e.second - 1) / 2; // a[i]の選び方
        total += ss[e.first]; // 選び方の総数
    }

    rep(i, n) {
        ll pp = max(ss[a[i]], 0ll);
        ll res = max((cnt[a[i]] - 1) * (cnt[a[i]] - 2) / 2, 0);
        cout << (total - pp + res) << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:21: error: no matching function for call to 'max(std::map<int, long long int>::mapped_type, int)'
   34 |         ll res = max((cnt[a[i]] - 1) * (cnt[a[i]] - 2) / 2, 0);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:34:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |         ll res = max((cnt[a[i]] - 1) * (cnt[a[i]] - 2) / 2, 0);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:34:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |         ll res = max((cnt[a[i]] - 1) * (cnt[a[i]] - 2) / 2, 0);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <bitset>
#define MOD1 1e9 + 7
#define MOD2 1e9 + 9
#define inf  (int)2e9
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))



using namespace std;


typedef long long ll;

int main() {

    int n;
    SCD(n);
    int hash[200005] = {0}, a[200005];
    for (int i = 0; i < n; i++) {
        SCD(a[i]);
        hash[a[i]]++;
    }
    
    lld sum = 0;
    for (int i = 0; i <= n; i++) {
        sum += (hash[i] * (hash[i] - 1)) / 2;
    }
    
    for (int i = 0; i < n; i++) {
        lld diff = (hash[a[i]] * (hash[a[i]] - 1)) / 2 - ((hash[a[i]] - 1) * (hash[a[i]] - 2)) / 2;
        printf("%lld\n", sum - diff);
    }
    
    return 0;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:5: error: 'lld' was not declared in this scope; did you mean 'll'?
   40 |     lld sum = 0;
      |     ^~~
      |     ll
a.cc:42:9: error: 'sum' was not declared in this scope
   42 |         sum += (hash[i] * (hash[i] - 1)) / 2;
      |         ^~~
a.cc:46:12: error: expected ';' before 'diff'
   46 |         lld diff = (hash[a[i]] * (hash[a[i]] - 1)) / 2 - ((hash[a[i]] - 1) * (hash[a[i]] - 2)) / 2;
      |            ^~~~~
      |            ;
a.cc:47:26: error: 'sum' was not declared in this scope
   47 |         printf("%lld\n", sum - diff);
      |                          ^~~
a.cc:47:32: error: 'diff' was not declared in this scope
   47 |         printf("%lld\n", sum - diff);
      |                                ^~~~
Language: C++

#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

    lol n;
    cin >> n;
    lol a[n + 5],sum[n + 5] = {};
    reps(i, n){
      cin >> a[i];
      sum[a[i]] ++;
    }
    lol ans = 0;
    reps(i, n){
      ans += (sum[i] * (sum[i] - 1)) / 2;
    }
    reps(i, n){
      lol a = sum[a[i]] * (sum[a[i]] - 1);
      lol b = (sum[a[i]] - 1) * (sum[a[i]] - 2);
      cout << (ans + b) -a  << '\n';
    }
	      
    return 0;
} 


Compiler output:
a.cc:6:28: error: extended character 　 is not valid in an identifier
    6 | #define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
      |                            ^
a.cc: In function 'int main()':
a.cc:38:20: error: invalid types 'long long int[int]' for array subscript
   38 |       lol a = sum[a[i]] * (sum[a[i]] - 1);
      |                    ^
a.cc:38:33: error: invalid types 'long long int[int]' for array subscript
   38 |       lol a = sum[a[i]] * (sum[a[i]] - 1);
      |                                 ^
a.cc:39:21: error: invalid types 'long long int[int]' for array subscript
   39 |       lol b = (sum[a[i]] - 1) * (sum[a[i]] - 2);
      |                     ^
a.cc:39:39: error: invalid types 'long long int[int]' for array subscript
   39 |       lol b = (sum[a[i]] - 1) * (sum[a[i]] - 2);
      |                                       ^
Language: Java

import java.util.*;
import static java.lang.System.*;

import java.io.IOException;
import java.io.InputStream;

public class Main{
  public static void main(String[] args){
	  FastScanner sc = new FastScanner();
	  int N = sc.nextInt();
	  int[]score = new int[N+1];
	  int[] k = new int[N+1];
	  long sum = 0;
	  
	  for(int i=0; i<N; i++) {
		  int n = sc.nextInt();
		  score[n]++;
		  k[i+1] = n;
	  }
	  for(int i=1; i<=N; i++) {
		  //out.println("score[i]" +  score[i]);
		  if(score[i] > 1) sum += (score[i] * (score[i]-1)) / 2;
		  //out.println(sum);
	  }
	  //out.println(sum);
	  for(int i=1; i<=N; i++) {
		  long ans = sum - score[k[i]] + 1;
		  if (ans < 0 ) ans = 0;
		  out.println(ans);
	  }

  }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte(){
        if(ptr < buflen){
            return true;
        }else{
            ptr = 0;
            try{
                buflen = in.read(buffer);
            }catch(IOException e){
                e.printStackTrace();
            }
            if(buflen <= 0){
                return false;
            }
        }
        return true;
    }
    private int readByte(){
        if(hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    private static boolean isPrintableChar(int c){
        return 33 <= c && c <= 126;
    }
    public boolean hasNext(){
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    public String next(){
        if(!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong(){
        if(!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        if(b < '0' || '9' < b){
            throw new NumberFormatException();
        }
        while(true){
            if('0' <= b && b <= '9'){
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt(){
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble(){
        return Double.parseDouble(next());
    }

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

#include <iostream>
#include <map>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> nums;
  int as[200000];
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (nums.find(a) == nums.end())
      nums.emplace(a, 1);
    else
      nums[a]++;
    as[i] = a;
  }
  ll count = 0;
  for (auto it : nums) {
    if (it.second > 1)
      count += it.second * (it.second - 1) / 2;
  }
  for (int i = 0; i < n; i++)
    cout << count - (nums[as[i]] > 1 ? nums[as[i]] - 1 : 0) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'll' was not declared in this scope
   18 |   ll count = 0;
      |   ^~
a.cc:21:7: error: 'count' was not declared in this scope
   21 |       count += it.second * (it.second - 1) / 2;
      |       ^~~~~
a.cc:24:13: error: 'count' was not declared in this scope
   24 |     cout << count - (nums[as[i]] > 1 ? nums[as[i]] - 1 : 0) << endl;
      |             ^~~~~
Language: C++

#include<iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int solve (int i, int ans);

int MAX_N = 200005;

int N;
int a[200000];
int b[200000] = {0};

int main()
{
    cin >> N;
    long int ans = 0;

    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        b[a[i]] += 1;
    }

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

    for (int i = 0; i < N; i++)
    {
        solve(i,ans);
    }
    return 0;
}

int solve (int i, long int ans)
{
    if (b[a[i]] >= 3)
    {
        ans = ans - b[a[i]] * (b[a[i]]-1) / 2 + (b[a[i]]-1) * (b[a[i]]-2) / 2;
    } else
    {
        ans = ans - b[a[i]] * (b[a[i]]-1) / 2;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int solve(int, long int)':
a.cc:51:1: warning: no return statement in function returning non-void [-Wreturn-type]
   51 | }
      | ^
/usr/bin/ld: /tmp/ccBHuLHQ.o: in function `main':
a.cc:(.text+0x159): undefined reference to `solve(int, int)'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
int main()
{
  int len,i,j,tot=0,last=-1;
  scanf("%d",&n);
  int num[n],pair[n],ot[n],stat[n];
  for(i=0;i<n;i++)
  { 
    scanf("%d",&num[i]);
    pair[i]=0;
    stat[i]=0;
  }
  for(i=0;i<n;i++)
  {
    if(stat[i]!=0)
      continue;
    stat[i]=1;
    for(j=0;j<n;j++)
    {
      if((i!=j)&&(num[i]==num[j]))
      {
        pair[i]++;
        tot++;
        last++;
        ot[last]=j;
      }
    }
    for(j=0;j<=last;j++)
    {
      pair[ot[j]]=pair[i];
      stat[ot[j]]=1;
    }
  }
  tot=tot/2;
  for(i=0;i<n;i++)
    printf("%d",tot-pair[i]);
  return 0;
}
  


Compiler output:
main.c: In function 'main':
main.c:5:15: error: 'n' undeclared (first use in this function)
    5 |   scanf("%d",&n);
      |               ^
main.c:5:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for ( int i = 0 ; i < n ; i++ ) {
    cin >> vec.at(i);
  }
  
  vector<int> data(n,0);
  for ( int i = 0 ; i < n ; i++ ) {
    data.at( vec.at(i)-1 ) +=1;
  }
  
  vector<int64_t> ans(n);
  int64_t sum =0;
  for ( int i = 0 ; i < n ; i++ ) {
    sum += data.at(i)*(data.at(i)-1)/2;
  }
  
  for ( int i = 0 ; i < n ; i++ ) {
    ans.at(i) = sum +1 - data.at( vec.at(i)-1 );
  }
  
  for ( int i = 0 ; i < n ; i++ ) {
    cout << ans.at(i) << endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:28:4: error: expected '}' at end of input
   28 |   }
      |    ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: Java

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

public class Main {

    public static void main(String[] args) {

        Scanner scn = new Scanner(System.in);
        long n = scn.nextLong();
        scn.nextLine();
        FreqMap map = new FreqMap();
        String[] arrstr = scn.nextLine().split(" ");
        long[] array = new long[n];

        for (int i = 0; i < n; i++) {
            array[i] = Integer.parseInt(arrstr[i]);
            map.add(array[i]);
        }
        long ans = 0;
        for (long num : map.map.values()) {
            ans += num * (num - 1) / 2;
        }

        for (int i = 0; i < n; i++) {
            long num = map.getCount(array[i]);
            long finalans = ans - (num * (num - 1) / 2) + ((num - 1) * (num - 2) / 2);
            System.out.println(finalans);
        }

    }

}

class FreqMap {
    HashMap<Long, Long> map;

    FreqMap() {
        map = new HashMap<>();
    }

    public void add(long n) {
        if (map.containsKey(n)) {
            map.put(n, map.get(n) + 1);
        } else {
            map.put(n, 1);
        }
    }

    public long getCount(long n) {
        return map.get(n);
    }
}

Compiler output:
Main.java:13: error: incompatible types: possible lossy conversion from long to int
        long[] array = new long[n];
                                ^
Main.java:45: error: incompatible types: int cannot be converted to Long
            map.put(n, 1);
                       ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()

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


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:40: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   18 |         cout<<all_ans-max((b[a[i]]-1,0)<<endl;
      |                           ~~~~~~~~~~~~~^~~~~~
Language: C++

#include <bits/stdc++.h>

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000

using namespace std;
typedef long long ll;
typedef pair<ll ,ll> P;
const ll mod = 1e9+7;
const long double EPS = 0.0000000001;

ll conb(ll x){
    return x*(x-1)/2;
}

ll n;
ll main(){
    cin >> n;
    vector<ll>a(n);
    map<ll,ll>mp;
    rep(i,0,n){
        cin >> a[i];
        mp[a[i]]++;
    }
    map<ll,ll>mp1,mp2;
    rep(i,0,n){
        mp1[a[i]] = conb(mp[a[i]]);
        mp2[a[i]] = conb(mp[a[i]]-1);
    }
    // for(auto x:mp1){
    //     cout << x.first << " " <<x.second << endl;
    // }
    // for(auto x:mp2){
    //     cout << x.first << " " <<x.second << endl;
    // }
    ll sum = 0;
    for(auto x: mp1){
        sum += x.second;
    }
    rep(i,0,n){
        cout << sum - mp1[a[i]] + mp2[a[i]] << endl;
    }
}

Compiler output:
a.cc:22:1: error: '::main' must return 'int'
   22 | ll main(){
      | ^~
Language: C++

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

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

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

#include<stdio.h>
#include<bits/stdc++.h>
int main()
{
	int n;
  	cin>>n;
  	int A[n];
  	int i;
  	for(i=0;i<n;i++)cin>>A[i];
  	vector<int>B(n+1,0);
  	long long int ans=0;
  	for(i=0;i<n;i++)
    {
      B[A[i]]++;
    }
    for(i=1;i<=n;i++)
    {
      if(B[i]>=2)
      {
		ans+=(B[i]*(B[i]-1))/2;
      }
    }
  	for(i=0;i<n;i++)
    {
		if(B[i]<2)
          printf("%ld\n",ans);
       else if(B[i]==2)
         printf("%ld\n",ans-1);
      else{
        long long int temp=ans;
        temp-=(B[i]*(B[i]-1))/2;
        temp+=((B[i]-2)*(B[i]-1))/2;
        printf("%ld\n",temp);
      }
    }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin>>n;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:10:9: error: 'vector' was not declared in this scope
   10 |         vector<int>B(n+1,0);
      |         ^~~~~~
a.cc:10:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:10:16: error: expected primary-expression before 'int'
   10 |         vector<int>B(n+1,0);
      |                ^~~
a.cc:14:7: error: 'B' was not declared in this scope
   14 |       B[A[i]]++;
      |       ^
a.cc:18:10: error: 'B' was not declared in this scope
   18 |       if(B[i]>=2)
      |          ^
a.cc:25:20: error: 'B' was not declared in this scope
   25 |                 if(B[i]<2)
      |                    ^
Language: C++

#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  int N;in(N);
  vector<int>A(N);
  map<int,int>cnt;
  set<int>kind;
  rep(i,N){
    int t;in(t);
    A[i]=t;
    cnt[t]++;
    kind.insert(t);
  }
  cpp_int sum=0;
  for(auto e:kind)sum+=cnt[e]*(cnt[e]-1)/2;
  rep(i,N){
    if(cnt[A[i]>1)out(sum-cnt[A[i]]*(cnt[A[i]]-1)/2+(cnt[A[i]]-1)*(cnt[A[i]]-2)/2);
    else out(sum-cnt[A[i]]*(cnt[A[i]]-1)/2);
  }
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Compiler output:
a.cc:12:9: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   12 | #include<boost/multiprecision/cpp_int.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YY cout << "Yes" << endl;
#define NN cout << "No" << endl;
#define ve vector
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
// *max_element(all(d))
// priority_queue<int,vector<int>,greater<int>>
class cum_sum{
  private:
    vector<long long>sum;
    vector<long long>tmp;
    int n;
  public:
    cum_sum(vector<long long>v):tmp(v),n(v.size()){
      sum.resize(n + 1);
      for(int i = 0; i < n; i++){
        sum[i + 1] = sum[i] + tmp[i];
      }
    };
    long long range_sum(int l, int r){
      if(l > r)swap(l,r);
      return sum[r + 1] - sum[l];
    }
}; 
vector<ll>countt(10000000);
int solve(){
  int n;
  cin >> n;
  vector<ll>v(n);
  map<ll,ll>m;
  rep(i,n){
    cin >> v[i];
    m[v[i]]++;
  }
  for(auto i : m){
    if(i.second > 1){
      ll tmp = i.second;
      ll t s= (tmp * (tmp - 1)) / 2;
      countt[i.first] = t;
    }
  }
  cum_sum sum(countt);
  rep(i,n){
    ll tmp = 0;
    if(m[v[i]] > 2){
      tmp += ((m[v[i]] - 1) * (m[v[i]] - 2)) / 2;
    }
    tmp += sum.range_sum(0,v[i] - 1);
    tmp += sum.range_sum(v[i] + 1,n);
    cout << tmp << endl;
  }

  return 0; 
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:53:12: error: expected initializer before 's'
   53 |       ll t s= (tmp * (tmp - 1)) / 2;
      |            ^
a.cc:54:25: error: 't' was not declared in this scope
   54 |       countt[i.first] = t;
      |                         ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  for(int h=0;h<N;h++){
    int k=0;
   for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      if(h!=i&&h!=j&&vec.at(i)==vec.at(j))
        k++
    }
   }
    cout << k << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: expected ';' before '}' token
   16 |         k++
      |            ^
      |            ;
   17 |     }
      |     ~
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
#deine int long long
using namespace std;
int sum[200005],ans[200005];
int a[200005];
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n;
	cin>>n;
	int x;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum[a[i]]++;
	}
	for(int i=1;i<200000;i++){
		x=x+(sum[i]*sum[i]-sum[i]);
		ans[i]=x-(sum[i]-1);
	}
	for (int i=1;i<=n;i++){
		cout<<ans[a[i]]<<endl;
	}
	return 0;
}


Compiler output:
a.cc:3:2: error: invalid preprocessing directive #deine; did you mean #define?
    3 | #deine int long long
      |  ^~~~~
      |  define
Language: C

#include <stdio.h>
#include <math.h>


int main(void){
	int n;
	int a[200000];

	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
	}

    int count = 0;
    for (int k = 0; k < n; ++k) {
        count = 0;
        for (int i = 0; i < n; ++i) {
            if (i == k) { continue; }

            for (int j = i + 1; j < n; ++j) {
                if (j == k) { continue; }
                if (a[i] == a[j]) {
                    ++count;
                }
            }
        }
        printf("%d",count);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
Language: Java

import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        final Map<Integer, Long> counts = new HashMap<>();
        int[] A = new int[N];
        for(int i = 0 ; i < N ; i++){
                A[i] = sc.nextInt();
                counts.put(A[i], 0);
        }

        final Solver solver = new Solver();
        solver.solve(N, A, counts);
    }
}

class Solver {
    public void solve(int N, int[] A, Map<Integer, Long> counts) {
        for (int i = 0; i < N; i++) {
            counts.put(A[i], counts.get(A[i]) + 1);
        }

        long total = 0;
        for (Map.Entry<Integer, Long> count : counts.entrySet()) {
            long c = count.getValue();
            total += c * (c - 1) / 2;
        }

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

            long c = counts.get(A[i]);
            ans -= c - 1;

            System.out.println(ans);
        }
    }
}



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

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

int main() {
  int64_t N,ans=0;
  cin >> N;
  vector<int64_t>A(N);
  vector<int64_t>B(N+1,0);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    B.at(A.at(i))++;
  }
  for(int i=1;i<=N;i++){
    ans+=(B.at(i)*(B.at(i)-1))/2;
  }
  for(int i=0;i<N;i++){
    cout << ans-max(0,B.at(A.at(i))-1) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)'
   17 |     cout << ans-max(0,B.at(A.at(i))-1) << 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:17:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'})
   17 |     cout << ans-max(0,B.at(A.at(i))-1) << 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:17:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   17 |     cout << ans-max(0,B.at(A.at(i))-1) << endl;
      |                 ~~~^~~~~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <math.h>


int main(void){
	int n;
	int a[200000];

	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", a[i]);
	}

    int count = 0;
    for (int k = 0; k < n; ++k) {
        count = 0;
        for (int i = 0; i < n; ++i) {
            if (i == k) { continue; }

            for (int j = i + 1; j < n; ++j) {
                if (j == k) { continue; }
                if (a[i] == a[j]) {
                    ++count;
                }
            }
        }
        printf("%d",count);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
Language: C++

#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int n;
	cin>>n;
	vector<int> ball(n);
	//vector<int> cnt(n+1,0);
	//vector<int> race;
	map<int,int> m;
	rep(i,n){
		cin>>ball[i];
		cnt[ball[i]]++;
		m[ball[i]]++;
	}
	ll ans = 0;
	for(auto x : m){
		ans += x.second * (x.second-1)/2;
	}
	//cout<<ans<<endl;
	rep(i,n){
		int now = ball[i];
		ll t = m[now];
		ll n_ans = ans;
		n_ans -= t * (t-1) /2;
		//cout<<n_ans<<endl;
		n_ans += max((t-1)*(t-2)/2,0LL);
		cout<<n_ans<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   35 |                 cnt[ball[i]]++;
      |                 ^~~
      |                 int
Language: C

#include<stdio.h>
int main()
{
  int len,i,j,tot=0;
  scanf("%d",&n);
  int num[n],pair[n];
  for(i=0;i<n;i++)
  { 
    scanf("%d",&num[i]);
    pair[i]=0;
  }
  for(i=0;i<n;i++)
  {
    for(j=0;j<n;j++)
    {
      if((i!=j)&&(num[i]==num[j]))
      {
        pair[i]++;
        tot++;
      }
    }
  }
  tot=tot/2;
  for(i=0;i<n;i++)
    printf("%d",tot-pair[i]);
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:5:15: error: 'n' undeclared (first use in this function)
    5 |   scanf("%d",&n);
      |               ^
main.c:5:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
using namespace std;
const int N = 2e5+5;
int a[N],n;
ll ans;
map<int,int>mp;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		mp[a[i]]++;
	}
	map<int,int>::iterator it;
	for(int i=0;i<n;i++)
	{
		mp[a[i]]--;
		ans=0;
		for(it=mp.begin();it!=mp.end();it++)
		ans+=it->second*(it->second - 1)/2;
		cout<<ans<<endl;
		mp[a[i]]++;
	}
	return 0;	
}

Compiler output:
a.cc:11:1: error: 'll' does not name a type
   11 | ll ans;
      | ^~
a.cc: In function 'int main()':
a.cc:25:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |                 ans=0;
      |                 ^~~
      |                 abs
Language: C++

#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<ll>
#define vvint vector<vint>
#define P pair<int,int>
#define INT_MAX 2147483647
#define MOD 1000000007
using namespace std;
typedef long long ll;


int main(void) {
	ll n; cin >> n;
	vint x(n+1),y(n);
	rep(i, n) {
		int m;
		cin >> m;
		x[m]++;
		y[i] = m;
	}
	ll sum=0;
	for (int i = 1; i <= n;i++) {
		sum += (x[i] * (x[i] - 1)) / 2;
	}

	rep(i, n) {
		cout << sum - x[y[i]] + 1 << endl;
	}

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: 'cin' was not declared in this scope
   21 |         ll n; cin >> n;
      |               ^~~
a.cc:9:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    8 | #include<set>
  +++ |+#include <iostream>
    9 | 
a.cc:35:17: error: 'cout' was not declared in this scope
   35 |                 cout << sum - x[y[i]] + 1 << endl;
      |                 ^~~~
a.cc:35:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:35:46: error: 'endl' was not declared in this scope
   35 |                 cout << sum - x[y[i]] + 1 << endl;
      |                                              ^~~~
a.cc:9:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    8 | #include<set>
  +++ |+#include <ostream>
    9 |
Language: C++

int main()
{

	cin >> N;

	A = vector<int>(N);

	vector<int>c(N+1);

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

		c[A[i]]++;
	}

	long long sum = 0;
	for (int i = 1; i <= N; i++) {
		if (c[i] > 1) {
			sum += (c[i] * (c[i] - 1)) / (long long)2;
		}
	}

	for (int i = 0; i < N; i++) {
		int t = c[A[i]];
		long long ans = sum - (t - 1);

		cout << ans << " ";

	}
	cout << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >> N;
      |         ^~~
a.cc:4:16: error: 'N' was not declared in this scope
    4 |         cin >> N;
      |                ^
a.cc:6:9: error: 'A' was not declared in this scope
    6 |         A = vector<int>(N);
      |         ^
a.cc:6:13: error: 'vector' was not declared in this scope
    6 |         A = vector<int>(N);
      |             ^~~~~~
a.cc:6:20: error: expected primary-expression before 'int'
    6 |         A = vector<int>(N);
      |                    ^~~
a.cc:8:16: error: expected primary-expression before 'int'
    8 |         vector<int>c(N+1);
      |                ^~~
a.cc:13:17: error: 'c' was not declared in this scope
   13 |                 c[A[i]]++;
      |                 ^
a.cc:18:21: error: 'c' was not declared in this scope
   18 |                 if (c[i] > 1) {
      |                     ^
a.cc:24:25: error: 'c' was not declared in this scope
   24 |                 int t = c[A[i]];
      |                         ^
a.cc:27:17: error: 'cout' was not declared in this scope
   27 |                 cout << ans << " ";
      |                 ^~~~
a.cc:30:9: error: 'cout' was not declared in this scope
   30 |         cout << endl;
      |         ^~~~
a.cc:30:17: error: 'endl' was not declared in this scope
   30 |         cout << endl;
      |                 ^~~~
Language: C++

#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;
#define int long long

static const int MAX = 300000;

int A[MAX], B[MAX], n, ans;

void print(int k){
    cout << ans - (B[A[k]] - 1) << endl;
}

int main(){
    ans = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> A[i];
        B[A[i]]++;
    }

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

    for(int i = 0; i < n; i++){
        print(i);
    }

    return 0;

}


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

#include<iostream>
#define fi        first
#define se        second
#define pb        push_back
#define PI        acos(-1)
#define LC(a)     ((a<<1))
#define RC(a)     ((a<<1)+1)
#define MID(a,b)  ((a+b)>>1)
#define mem(a, b) memset(a, b, sizeof(a))
#define IOS()     std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<ll,ll>   PLL;
typedef pair<ll,int>  PLI;
const int INF = 0X3F3F3F3F;
const int MIN = -(1<<30);
const ll N = 2e5+7;
ll a[N];
inline void solve()
{
	int n;
	cin>>n;
	set<ll> s;
	map<ll,ll> mp;
	for(int i=1; i<=n; i++)
	{
		cin>>a[i];
		s.insert(a[i]);
		mp[a[i]]++;
	}
	
	for(int i=1;i<=n;i++)
	{
		ll ans = 0;
		mp[a[i]]--;
		for(auto it:s)
		{
			ans += mp[it]*(mp[it]-1)/2;
		}
		cout<<ans<<endl;
		
		mp[a[i]]++;
	}


}
int main()
{
	IOS();
	solve();
	return 0;
}




Compiler output:
a.cc: In function 'void solve()':
a.cc:25:9: error: 'set' was not declared in this scope
   25 |         set<ll> s;
      |         ^~~
a.cc:2:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    1 | #include<iostream>
  +++ |+#include <set>
    2 | #define fi        first
a.cc:25:15: error: expected primary-expression before '>' token
   25 |         set<ll> s;
      |               ^
a.cc:25:17: error: 's' was not declared in this scope
   25 |         set<ll> s;
      |                 ^
a.cc:26:9: error: 'map' was not declared in this scope
   26 |         map<ll,ll> mp;
      |         ^~~
a.cc:2:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    1 | #include<iostream>
  +++ |+#include <map>
    2 | #define fi        first
a.cc:26:15: error: expected primary-expression before ',' token
   26 |         map<ll,ll> mp;
      |               ^
a.cc:26:18: error: expected primary-expression before '>' token
   26 |         map<ll,ll> mp;
      |                  ^
a.cc:26:20: error: 'mp' was not declared in this scope
   26 |         map<ll,ll> mp;
      |                    ^~
Language: C++

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import java.util.Stack;


public class Main{
	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception addd) {
					addd.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception addd) {
				addd.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	
	public static FastReader sc = new FastReader();
 
	static int mod = (int) (998244353);
	static List<Integer>[] edges ;
	static long[][] dp;
	
	final static int MAX = Integer.MAX_VALUE/10 ;

	public static void main(String[] args) {
		  
		int n = sc.nextInt();
		int[] a = new int[n+1];
		Map<Integer,Integer> map = new HashMap<>();
		for(int i=1;i<=n;++i) {
			a[i] = sc.nextInt();
			map.put(a[i], map.getOrDefault(a[i], 0)+1);
		}
		long ans = 0;
		for(int key : map.keySet()) {
			long x = map.get(key);
			ans+=(x*(x-1))/2;
		}
		//out.println(ans);
		for(int i=1;i<=n;++i) {
			int key = map.get(a[i]);
			long temp = ans;
			temp-=(key*(key-1))/2;
			temp+=((key-1)*(key-2))/2;
			out.println(temp);
		}
	out.close();
}
}
	


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.math.BigInteger;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.Map.Entry;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.Stack;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
    8 | public class Main{
      | ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    long long N;cin>>N;
    map<long long int ,long long int> Hash;
    long long arr[N];
    for(long long i=0;i<N;i++)
    {
        long long int x;
        cin>>x;
        arr[i]=x;
        Hash[x]++;
    }
    long long int Total=0;
    for(auto it:Hash)
    {
        Total+=((it.second)*(it.second-1))/2;
    }
    for(long long int i=0;i<N;i++)
    {
        long long int z=Hash[arr[i]];
        cout<<Total-((z)*(z-1))/2+((z-1)*(z-2))/2<<endl;
    }


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

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
#define MAX_N 200005
int n;
LL va[MAX_N];
LL num[MAX_N];
LL ans;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>va[i];
	for(int i=1;i<=n;i++)num[va[i]]++;
	for(int i=1;i<=n;i++)if(num[i])ans+= num[i]*(num[i]-1)/2;
	for(int i=1;i<=n;i++)
		printf("%lld\n",ans- num[va[i]]+1);
}

Compiler output:
a.cc:9:1: error: 'LL' does not name a type
    9 | LL va[MAX_N];
      | ^~
a.cc:10:1: error: 'LL' does not name a type
   10 | LL num[MAX_N];
      | ^~
a.cc:11:1: error: 'LL' does not name a type
   11 | LL ans;
      | ^~
a.cc: In function 'int main()':
a.cc:14:35: error: 'va' was not declared in this scope
   14 |         for(int i=1;i<=n;i++)cin>>va[i];
      |                                   ^~
a.cc:15:30: error: 'num' was not declared in this scope; did you mean 'enum'?
   15 |         for(int i=1;i<=n;i++)num[va[i]]++;
      |                              ^~~
      |                              enum
a.cc:15:34: error: 'va' was not declared in this scope
   15 |         for(int i=1;i<=n;i++)num[va[i]]++;
      |                                  ^~
a.cc:16:33: error: 'num' was not declared in this scope; did you mean 'enum'?
   16 |         for(int i=1;i<=n;i++)if(num[i])ans+= num[i]*(num[i]-1)/2;
      |                                 ^~~
      |                                 enum
a.cc:16:40: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |         for(int i=1;i<=n;i++)if(num[i])ans+= num[i]*(num[i]-1)/2;
      |                                        ^~~
      |                                        abs
a.cc:18:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |                 printf("%lld\n",ans- num[va[i]]+1);
      |                                 ^~~
      |                                 abs
a.cc:18:38: error: 'num' was not declared in this scope; did you mean 'enum'?
   18 |                 printf("%lld\n",ans- num[va[i]]+1);
      |                                      ^~~
      |                                      enum
a.cc:18:42: error: 'va' was not declared in this scope
   18 |                 printf("%lld\n",ans- num[va[i]]+1);
      |                                          ^~
Language: C++

n = int(input())
a= list(map(int, input().split()))
from collections import Counter
c=Counter(a)
dic={}
for k,v in c.items():
    dic[k]=v*(v-1)//2
su=0
for k in dic.values():
    su+=k
for i in a:
    print(su-dic[i]+(c[i]-1)*(c[i]-2)//2)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
a.cc:6:1: error: expected unqualified-id before 'for'
    6 | for k,v in c.items():
      | ^~~
Language: C++

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

int main(){
  ll N;
  cin >> N;
  vactor<ll> A(N);
  rep(i,N)
    cin >> A.at(i);
  map<ll,ll> ball;
  rep(i,N){
    if(ball.count(A.at(i))){
      ++ball.at(A.at(i));
    }else{
      ball[A.at(i)] = 1;
    }
  }
  rep(i,N){
    ll cnt = 0;
    ll num = A.at(i);
    --ball.at(num);
    for(auto p : ball){
      auto v = p.second;
      if(v<=1){
        continue;
      }else{
        cnt += (v*(v-1)/2);
      }
    }
    cout << cnt << endl;
    ++ ball.at(num);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'vactor' was not declared in this scope
   10 |   vactor<ll> A(N);
      |   ^~~~~~
a.cc:10:12: error: expected primary-expression before '>' token
   10 |   vactor<ll> A(N);
      |            ^
a.cc:10:14: error: 'A' was not declared in this scope
   10 |   vactor<ll> A(N);
      |              ^