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

 #include <bits/stdc++.h>
#define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ll long long
#define endl '\n'
//pair<int, int> *p=new pair<int, int>[n];
//std::vector<pair<int,int>> vp;
//v.push_back(make_pair(x,y))
//pair<int, int> p[1000001];
//string *s=new string [n];
//int freq[e];
//freq[a[i]-'a']++; freq[a[i]]++;
 using namespace std;  
ll n,t,m,c,x,y,sum,mx,mn,avg,pos,dif,j,dis;

map<ll, ll >mp;
bool vis[1e5];
bool isPrime(int x)
{
for (int i=2;i*i<=x;i++)
if (x%i==0)
return false;
return true;
}

int main(void) 
{ 
   
        SpeeD
      cin>>n;
       ll *a = new ll [n];
   
       for (int i = 0 ; i <n;i++ ){
       cin>>a[i];
       mp[a[i]]++;
     
       }
     
         for (int i=0;i<n;i++){
         if (!vis[a[i]])
   m+=(mp[a[i]]*(mp[a[i]]-1))/2;
   vis[a[i]]=true;
  
}
for (int i = 0; i <n;i++ ){
    cout<<m-mp[a[i]]+1<<endl;

}
  
     
     
}


Compiler output:
a.cc:16:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   16 | bool vis[1e5];
      |          ^~~
a.cc:16:10: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
   16 | bool vis[1e5];
      |          ^~~
      |          |
      |          double
a.cc:16:10: error: size of array 'vis' has non-integral type 'double'
Language: Java

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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = readInt(sc);
        int[] list = new int[n];
        int[] map = new int[n];
        int[] ansMemo = new int[n];
        
        for (int i = 0; i < n; i++) {
            list[i] = -1;
            map[i] = -1;
            ansMemo[i] = -1;
        }
        for (int i = 0; i < n; i++) {
            int tmp = readInt(sc);
            list[i] = tmp;
            if (map[i] != -1) {
                map[i]++;
            } else {
                map[i] =1;
            }
        }
        


        
        for (int i = 0; i < n; i++) {
            int k = list[i];
            if(ansMemo[k] != -1){
                System.out.println(ansMemo[k]);
                continue;
            }
            int[] m = new int[n];
            int[] memo = new int[n];
            for (int j = 0; j < n; j++) {
                memo[j] = -1;
            }
            System.arraycopy(map, 0, m, 0, n);
            m[k] = map[k]-1;
            int ans = 0;
            for (int val : m) {
                if(val == -1) continue;
                for (int j = 0; j < n; j++) {
                if (memo[val] != -1) {
                    ans += memo[val];
                    continue;
                }
                int cal = val * (val - 1) / 2;
                ans += cal;
                memo[val] = cal;
            }
            System.out.println(ans);
            ansMemo[k] =ans;
        }

    }

    static int readInt(Scanner sc) {
        return Integer.parseInt(sc.next());
    }
}

class Pair {
    private int x;
    private int y;

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public Pair() {

    }

    public Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object obj) {
        // TODO ちゃんと書く

        return this.x == ((Pair) obj).getX() && y == ((Pair) obj).getY();
    }

}

Compiler output:
Main.java:63: error: illegal start of expression
    static int readInt(Scanner sc) {
    ^
1 error
Language: C++

#include <iostream>
using namespace std;
int main(void){
    long long int n,kari[110000],kiroku[110000];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>kari[i];
        kiroku[kari[i]]++;
    }
    
    long long int goukei=0;
    
    for(int i=1;i<n;i++){
        if(kiroku[i]>=2){
            goukei+=kiroku[i]*(kiroku[i]-1)/2;
        }
        else{
    
    long long int ans;
    for(int i=0;i<n;i++){
        if(kiroku[kari[i]]>=3){
            ans=goukei-(kiroku[kari[i]]*(kiroku[kari[i]]-1)/2-(kiroku[kari[i]]-1)*(kiroku[kari[i]]-2)/2);
        }
        else if(kiroku[kari[i]]==2){
            ans=goukei-1;
        }
        else{
            ans=goukei;
        }
        cout<<ans<<endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:13:25: note: to match this '{'
   13 |     for(int i=1;i<n;i++){
      |                         ^
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:3:15: note: to match this '{'
    3 | int main(void){
      |               ^
Language: C++

#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include <cmath>
//#include <bits/stdc++.h>
using namespace std;

int main(){
    long int N;
    cin>>N;
    long int A[N+1],B[N+1];
    for (int i=0;i<N;i++){
        cin>>A[i];
        B[i]=A[i];
    }
    sort(A,A+N);
    A[N]=0;
    long int num[N],ans=0,j=0,f[N],k=0,l=-1;
    for (int i=0;i<N;i++){
        if (A[i]!=A[i+1]){
            num[j]=A[i];
            k=i-l;
            l=i;
            ans+=(k+1)*k/2;
            f[A[i]]=-(k+1)*k/2+(k-1)*k/2;
            j+=1;
        }
    }
    for (int i=0;i<N;i++){
        cout<<ans+f[B[i]]<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   17 |     sort(A,A+N);
      |     ^~~~
      |     sqrt
Language: Java



import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

import atcoder.triangle.MyScanner;

public class Main {
	
	public static void main(String[] args) throws java.lang.Exception {
	      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	      MyScanner sc = new MyScanner();
	      out = new PrintWriter(new BufferedOutputStream(System.out));
	      
	      int n = sc.nextInt();
	      int ar[] = new int[n];
	      String s[] = sc.nextLine().split(" ");
	      for(int i = 0; i < n;i++)
	    	  ar[i] = Integer.parseInt(s[i]);
	      Arrays.parallelSort(ar);
	      int count = 0;
	      for(int k = 1; k <= n; k++) {
	    	  count = 0;
	    	  for(int i = 0; i < n-1; i++) {
	    		  if(k!=i && ar[i] == ar[i+1])
	    			  count++;
	    	  }
	    	  System.out.println(count);
	      }
	      out.close();
	}
	public static PrintWriter out;

	   public static class MyScanner {
	      BufferedReader br;
	      StringTokenizer st;
	 
	      public MyScanner() {
	         br = new BufferedReader(new InputStreamReader(System.in));
	      }
	 
	      String next() {
	          while (st == null || !st.hasMoreElements()) {
	              try {
	                  st = new StringTokenizer(br.readLine());
	              } catch (IOException e) {
	                  e.printStackTrace();
	              }
	          }
	          return st.nextToken();
	      }
	 
	      int nextInt() {
	          return Integer.parseInt(next());
	      }
	 
	      long nextLong() {
	          return Long.parseLong(next());
	      }
	 
	      double nextDouble() {
	          return Double.parseDouble(next());
	      }
	 
	      String nextLine(){
	          String str = "";
		  try {
		     str = br.readLine();
		  } catch (IOException e) {
		     e.printStackTrace();
		  }
		  return str;
	      }

	   }


}


Compiler output:
Main.java:11: error: package atcoder.triangle does not exist
import atcoder.triangle.MyScanner;
                       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
long dpp[max][max];

long nCr(int n, int r)
{
       if(n==r) return dp[n][r] = 1;
       if(r==0) return dp[n][r] = 1;
       if(r==1) return dp[n][r] = n;
       if(dp[n][r]) return dp[n][r];
       return dpp[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}

void solve(){
    //COMinit();
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    map<int, int> mp;
    REP(i, N) mp[A[i]]++;

    ll dp[200000] = {0};
    REP(k,N){
        int index = mp[A[k]];
        if(dp[index]==0){
            mp[A[k]]--;
            ll res = 0;
            for(auto it=mp.begin(); it!=mp.end(); it++){
                int tmp = it->second;
                res += nCr(tmp, 2);
                //cout << res << endl;
            }
            dp[index] = res;
            mp[A[k]]++;
        }
        cout << dp[index] << endl;
    }
}

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

Compiler output:
a.cc:6:18: error: cannot resolve overloaded function 'max' based on conversion to type 'long unsigned int'
    6 | long dpp[max][max];
      |                  ^
a.cc:6:6: error: size of array 'dpp' has non-integral type '<unresolved overloaded function type>'
    6 | long dpp[max][max];
      |      ^~~
a.cc:6:18: error: cannot resolve overloaded function 'max' based on conversion to type 'long unsigned int'
    6 | long dpp[max][max];
      |                  ^
a.cc:6:6: error: size of array 'dpp' has non-integral type '<unresolved overloaded function type>'
    6 | long dpp[max][max];
      |      ^~~
a.cc: In function 'long int nCr(int, int)':
a.cc:10:24: error: 'dp' was not declared in this scope; did you mean 'dup'?
   10 |        if(n==r) return dp[n][r] = 1;
      |                        ^~
      |                        dup
a.cc:11:24: error: 'dp' was not declared in this scope; did you mean 'dup'?
   11 |        if(r==0) return dp[n][r] = 1;
      |                        ^~
      |                        dup
a.cc:12:24: error: 'dp' was not declared in this scope; did you mean 'dup'?
   12 |        if(r==1) return dp[n][r] = n;
      |                        ^~
      |                        dup
a.cc:13:11: error: 'dp' was not declared in this scope; did you mean 'dup'?
   13 |        if(dp[n][r]) return dp[n][r];
      |           ^~
      |           dup
Language: C++

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

long long int N;
long long int A[1000000];
long long int K[1000000];
long long int C_d[1000000];

int main(){
    cin >> N;

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

    // 組み合わせの数
    long long int allc = 0;
    for(long long int i=0;i<N;i++){
        long long int a = A[i];
        long long int c = a*(a-1)/2;
        allc += c;
        // 値がiのものについて、i==kのときに減る数
        C_d[i] = c - (a-1)*(a-2)/2;
    }

    for(long long int j=0;j<N+;j++){
        cout << allc - C_d[K[j]] << endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:31: error: expected primary-expression before ';' token
   30 |     for(long long int j=0;j<N+;j++){
      |                               ^
Language: C++

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

int64_t nC2(int64_t x){
    if(x == 0 || x == 1){
        return 0;
    }else{
        return x * (x - 1)/2;
    }
}

int main(){ 
    int n; cin >> n;
    vector<int> a(n);
    vector<int64_t> list(n);
    int64_t sum = 0;
    
    for(int i = 0; i < n; i++){
        cin >> a.at(i);
        list.at(a.at(i) - 1) += 1;
    }
    
    for(int i = 0; i < n; i++){
        sum += nC2(list.at(i));
    }
    
    
    for(int i = 0; i < n; i++){
        if(list.at(a.at(i) - 1) == 0 || list.at(a.at(i) - 1) == 1){
            cout << sum << endl;
        }else{
            int diff = list.at(a.at(i) - 1) - 1; 
            cout << sum - diff << endl;
        }
    }
    

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

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

int a[200500];
struct p
{
    ll n;
    ll num;
    ll all;
} b[200500];
int c[200500];

int main()
{
    int n;
    cin>>n;
    int i;
    int k=0;
    for(i=0; i<n; i++)
    {
        int x;
        scanf("%d",&x);
        b[x].n++;
        a[i]=x;
        if(b[x].n==2)
            c[k++]=x;
    }
    for(int j=0; j<k; j++)
        if(b[c[j]].n)
            b[c[j]].num=b[c[j]].n*(b[c[j]].n-1)/2;
    ll number=0;
    for(i=0; i<k; i++)
    {
        int x=c[i];
        ll t=0;
        for(int j=0; j<k; j++)
            t+=b[c[j]].num;
        t=t-b[c[j]].n+1;
        if(t)
            b[x].all=t;
        else
            b[x].all=-1;
        number+=b[x].num;
    }
    for(i=0; i<n; i++)
        if(b[a[i]].all>0)
            printf("%lld\n",b[a[i]].all);
        else if(b[a[i]].all)
            printf("0\n");
        else
            printf("%lld\n",number);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:17: error: 'j' was not declared in this scope
   39 |         t=t-b[c[j]].n+1;
      |                 ^
Language: C++

#include<iostream>
#include<vector>
#include <string>

using namespace std;

int main() {

	int N;
	cin >> N;

	int G_Sum = 0;

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


	vector<vector<int>> B(N, vector<int>(0));

	for (int i = 0; i < N; i++) {
		B[A[i] - 1].push_back(i);
	}

	for (int k = 0; k < N; k++) {
		for (int i = 0; i < N; i++) {
			int Sum = 0;
			for (int j = 0; j < B[i].size(); j++) {
				if (B[i][j] != k) {
					Sum++;
				}
			}
			G_Sum += 0.5 * Sum * (Sum - 1);
		}
		cout << G_Sum << "\n";
		G_Sum = 0;
	}

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

import java.util.*;
import java.io.*;
public class wow {
	public static void main(String args[]) throws Exception {
		Scanner scan = new Scanner(System.in);
		int balls = scan.nextInt();
		int[] values = new int[balls];
		int max = 0;
		for (int i = 0; i < balls; i++) {
			values[i] = scan.nextInt();
			if (values[i] > max) max = values[i];
		}

		int[] combos = new int[max];
		for (int k = 0; k < balls; k++) {
			combos[values[k] - 1]++;
		}		
		for (int i = 0; i < balls; i++) {
			int sum = 0;
			combos[values[i] - 1]--;
			for (int k = 0; k < combos.length; k++) {
				if (combos[k] != 0)	
                sum += (combos[k] * (combos[k] - 1)) / 2;
			}
			combos[values[i] - 1]++;
			System.out.println(sum);
		}
	}
}


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

#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main() {

    int N;
    cin >> N;
    int A[N];
    int B[N];
    rep(i,N){
        cin >> A[i];
        B[i] = A[i];
    }
    sort(B,B+N);
    int C[N];
    rep(i,N) C[i] = 0;
    int D[N];
    rep(i,N) D[i] = 0;
    int M = 0;
    int num = 0;
    bool isSame = false;
    rep(i,N){
        if(i>0 && B[i] == B[i-1]){
            C[num] ++;
            if(isSame == false){
                D[num] = B[i];
                M++;
            }
            isSame = true;
        }else{
            if(isSame == true){
                num++;
                isSame = false;
            }
        }
    }
    ll sum = 0;
    rep(i,N){
        if(C[i]>0) sum += C[i]*(C[i]+1)/2;
    }
    ll out = 0;
    rep(i,N){
        rep(j,M){
            if(A[i] == D[j]){
                out = sum - C[j]*(C[j]+1)/2 + C[j]*(C[j]-1)/2;
            }
        }
        cout << out << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   22 |     sort(B,B+N);
      |     ^~~~
      |     sqrt
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


long long calc(vector<int>& occ) {
  int sz = occ.size();
  long long res = 0;
  for (int i = 0; i < sz; ++i) {
    res += (occ[i] * (occ[i] - 1))/ 2;
  }
  return res;
}


int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  const int N = 2e5 + 1;
  vector<long long> occ(N, 0);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    occ[a[i]]++;
  }
  long long res = calc(occ);
  for (int i = 0; i < n; ++i) {
    int m = (occ[a[i]] * (occ[a[i]] - 1))/ 2;
    occ[a[i]]--;
    int n = (occ[a[i]] * (occ[a[i]] - 1))/ 2;
    occ[a[i]]++;
    int res2 = res - m + n;
    cout << res2 << '\n';
  }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:24: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<long long int>'
   30 |   long long res = calc(occ);
      |                        ^~~
a.cc:8:29: note: in passing argument 1 of 'long long int calc(std::vector<int>&)'
    8 | long long calc(vector<int>& occ) {
      |                ~~~~~~~~~~~~~^~~
Language: C++

#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h>/*限界*/

#define rep(i, n) for(int  i = 0; i < (n); i++)
#define max(a,b) ((a>b)?a:b)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)

//abc 159 D

int main(void)
{
  int N;
  int *array;
  int *b;
  LL *c;
  LL *d;
  LL sum = 0;
  scanf("%d", &N);

  array = (int *)malloc(sizeof(int) * (N+1));
  if (array == NULL) {
    exit(0);
  }

  b = (int *)malloc(sizeof(int) * (N+1));
  if (b == NULL) {
    exit(0);
  }

  c = (int *)malloc(sizeof(LL) * (N+1));
  if (c == NULL) {
    exit(0);
  }

  d = (int *)malloc(sizeof(LL) * (N+1));
  if (d == NULL) {
    exit(0);
  }
  //input
  for (size_t i = 0; i < N; i++) {
    scanf("%d", &array[i]);
  }

  for (size_t i = 0; i <=N; i++) {
    b[i] = 0;
    c[i] = 0;
    d[i] = 0;
  }

  for (size_t i = 0; i < N; i++) {
    b[array[i]]++;
  }

  sum = 0;
  for (size_t i = 1; i <= N; i++) {
    if (b[i] >= 2) {
      c[i] = (b[i] - 2) * (b[i] - 1) / 2;
      d[i] = (b[i] - 1) * b[i] / 2;
      sum += d[i];
    }else{
      c[i] = 0;
      d[i] = 0;
    }
  }

  //output
  for (size_t i = 0; i < N; i++) {
    printf("%ld\n",c[array[i]] - d[array[i]] + sum );
  }

  free(array);/*メモリ開放を忘れずに*/
  free(b);
  free(c);
  free(d);

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:7: error: cannot convert 'int*' to 'long long int*' in assignment
   38 |   c = (int *)malloc(sizeof(LL) * (N+1));
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       |
      |       int*
a.cc:43:7: error: cannot convert 'int*' to 'long long int*' in assignment
   43 |   d = (int *)malloc(sizeof(LL) * (N+1));
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       |
      |       int*
Language: Java


//package practice;

import java.util.*;

import java.io.*;
import java.math.*;

public class Main {

	public static void main(String args[]) throws Exception {
		Scanner scan = new Scanner(System.in);
		int[] values = new int[scan.nextInt()];
		for (int i = 0; i < balls; i++) {
			values[i] = scan.nextInt();
		}

		int[] combos = new int[balls];
		for (int k = 0; k < balls; k++) {
			combos[values[k] - 1]++;
		}
		
		for (int i = 0; i < balls; i++) {
			int sum = 0;
			combos[values[i] - 1]--;
			for (int k = 0; k < balls; k++) {
				if (combos[k] != 0)
				sum += (combos[k] * (combos[k] - 1)) / 2;
			}
			combos[values[i] - 1]++;
			System.out.println(sum);
		}

	}
}


Compiler output:
Main.java:14: error: cannot find symbol
		for (int i = 0; i < balls; i++) {
		                    ^
  symbol:   variable balls
  location: class Main
Main.java:18: error: cannot find symbol
		int[] combos = new int[balls];
		                       ^
  symbol:   variable balls
  location: class Main
Main.java:19: error: cannot find symbol
		for (int k = 0; k < balls; k++) {
		                    ^
  symbol:   variable balls
  location: class Main
Main.java:23: error: cannot find symbol
		for (int i = 0; i < balls; i++) {
		                    ^
  symbol:   variable balls
  location: class Main
Main.java:26: error: cannot find symbol
			for (int k = 0; k < balls; k++) {
			                    ^
  symbol:   variable balls
  location: class Main
5 errors
Language: C++

#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int>a(n);
    map<int,int>dic;
    for(int i=0;i<n;i++){
        int temp;
        cin>>temp;
        a[i]=temp;
        if(dic.count(temp))
            dic[temp]++;
        else
            dic[temp]=1;
    }
    map<int,int>sp;
    for(int i=0;i<a.size();i++){
        int cnt=0;
        if(sp.count(a[i]))
            cout<<sp[a[i]]<<endl;
        else{
            for(auto it:dic){
                if(it.first==a[i]){
                    cnt+=(it.second-1)(it.second-2)/2;
                }
                else{
                    cnt+=(it.second)(it.second-1)/2;
                }
            }
            cout<<cnt<<endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:39: error: expression cannot be used as a function
   28 |                     cnt+=(it.second-1)(it.second-2)/2;
      |                          ~~~~~~~~~~~~~^~~~~~~~~~~~~
a.cc:31:37: error: expression cannot be used as a function
   31 |                     cnt+=(it.second)(it.second-1)/2;
      |                          ~~~~~~~~~~~^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
 
    int A[N];
    int list[N+1] = {0};
    for(int i=0; i<N; i++){
        cin >> A[i];
        list[A[i]]++;
    }
 
    long long ans = 0;
    int buf;
 
    for(int i=0; i<N; i++){
        list[A[i]]--;
        for(int j=0; j<N; j++){
            // cout << list[j] << endl;
            if(list[j] != 0){
                ans += list[j] * (list[j]-1) / 2;
            }
        }
        // cout << ans << endl;
        printf("%ld\n", ans);
        ans = 0;
        list[A[i]]++;
    }
    
    return 0;
}

    return 0;
}

Compiler output:
a.cc:35:5: error: expected unqualified-id before 'return'
   35 |     return 0;
      |     ^~~~~~
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;
typedef unsigned int UINT;
typedef int INT;

#if 0
//No.5
int main()
{
	INT H, W, K;
	cin >> H >> W >> K;

}
#endif

#if 1
//No.4-2
int main()
{
	INT N;
	cin >> N;

	vector<INT> A(N);
	vector<INT> count(N+1);
	INT totalSelect = 0;

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

	//同じ数が何個存在するか
	for (int i = 0; i < N; ++i) {
		count[A[i]] += 1;
	}

	//同じ数の選び方、合計。nC2 = n * (n-1) / 2
	for (int i = 0; i < N; ++i) {
		totalSelect += count[i] * (count[i] - 1) / 2;
	}

	//選び方の個数を補正。
	string ret = "";
	for (int k = 0; k < N; ++k) {
		INT value = A[k];
		INT actual = (count[value] - 1) * (count[value] - 2) / 2;
		INT ori    = (count[value]    ) * (count[value] - 1) / 2;

		cout << to_string(totalSelect - ori + actual) << endl;
//		ret += to_string(totalSelect - ori + actual) + "\n";
	}

//	cout << ret;

	//	delete[] A;
	return 0;
}

Compiler output:
a.cc:21: error: unterminated #if
   21 | #if 1
Language: C++

#include <iostream>
using namespace std;
int main () {
  int n;
  cin >> n;
  int a[200000] = {};
  int c[200000] ~ {};
  
  for (int i = 0; i < n; i++) cin >> a[i];
  
  for (int i = 0; i < n; i++) {
    int ans = 0;
    
    if (c[a[i]] != 0) {
      ans = c[a[i]];
    } else {
      for (int j = 0; j < n - 1; j++) {
        for (int k = j + 1; k < n; k++) {
          if (j == i || k == i) continue;
          if (a[j] == a[k]) ans++;
        }
      }
      c[a[i]] = ans;
    }
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: expected initializer before '~' token
    7 |   int c[200000] ~ {};
      |                 ^
a.cc:14:9: error: 'c' was not declared in this scope
   14 |     if (c[a[i]] != 0) {
      |         ^
Language: Java

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

/*
説明
*/
public class Main {
    public static void main(String[] args){

        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[] = new int[n];

        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            a[i] = s.nextInt();

            if (map.get(a[i]) == null) {
                map.put(a[i], 1);
            } else {
                map.put(a[i], map.get(a[i])+1);
            }
        }

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

            for (int key :map.keySet()) {
                if (key == a[i]) {
                    ans += (map.get(key) - 1) * (map.get(key) - 2);
                } else {
                    ans += map.get(key) * (map.get(key) - 1);
                }
            }

            if (map.size() == 1) {
                ans += map.get(a[0]- 1) * (map.get(key) - 2);
            }
            System.out.println(ans / 2);
        }

    }
}

Compiler output:
Main.java:37: error: cannot find symbol
                ans += map.get(a[0]- 1) * (map.get(key) - 2);
                                                   ^
  symbol:   variable key
  location: class Main
1 error
Language: C++

#include<bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

using ll = long long;
using P = pair<int , int>;
  
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  int a[n];
  LL b[n]; rep(i, n) b[i] = 0;
  
  rep(i, n) {
    int x; cin >> x;
    a[i] = x;
    ++b[x-1];
  }

  ll sum = 0;
  rep(i, n) {
    sum += ((b[i]*(b[i]-1))/2);
  }
  
  rep(i, n) {
    ll x = (b[a[i]-1] * (b[a[i]-1] - 1)) / 2;
    ll di = ((b[a[i]-1] - 1) * (b[a[i]-1] - 2)) / 2;
    cout << (sum - (x - di)) << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'LL' was not declared in this scope; did you mean 'll'?
   16 |   LL b[n]; rep(i, n) b[i] = 0;
      |   ^~
      |   ll
a.cc:16:22: error: 'b' was not declared in this scope
   16 |   LL b[n]; rep(i, n) b[i] = 0;
      |                      ^
a.cc:21:7: error: 'b' was not declared in this scope
   21 |     ++b[x-1];
      |       ^
a.cc:26:14: error: 'b' was not declared in this scope
   26 |     sum += ((b[i]*(b[i]-1))/2);
      |              ^
a.cc:30:13: error: 'b' was not declared in this scope
   30 |     ll x = (b[a[i]-1] * (b[a[i]-1] - 1)) / 2;
      |             ^
Language: C++

#include<stdio.h>

int main(){
    int n,i,j,x,k = 0,cnt = 0;
    scanf("%d",&n);
    int a[n];
    for(i = 0; i < n; i++){
        scanf("%d",&a[i]);
    }
    for(x = 0; x < n; x++){
        for(i = 0; i < n; i++){
            if(i == k){
                i++;
            }
            for(j = 0; i < n; j++){
                if(k == j){
                    j++;
                }
                if(i == j){
                    j++;
                }
                if(a[i]==a[j]){
                    cnt++;
                }
            }
        printf("%d",cnt);
        cnt = 0;
    }
    return 0;
}

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

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>

using namespace std;

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


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

	int* count = new int[N + 1]();
	int* A = new int[N];

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


		count[A[i]]++;
	}

	long double sum = 0;
	for (int i = 0; i < N; i++) {
		if (count[A[i]] != 1) {
			sum += (long double)computeComb(count[A[i]]) / (long double)count[A[i]];
		}
	}

	for (int i = 0; i < N; i++) {
		cout << round(sum) - count[A[i]] + 1 << "\n";
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:25: error: 'round' was not declared in this scope
   36 |                 cout << round(sum) - count[A[i]] + 1 << "\n";
      |                         ^~~~~
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define size 200000
#define NUM 998244353
#define ll long long int
 
int main()
{
  int n;
  cin>>n;
  int arr[n+1];
   for(int i=0;i<n+1;i++)
     arr[i]=0;
  int arr2[n];
  for(int i=0;i<n;i++)
  {
    cin>>arr2[i];
    arr[arr2[i]]++;
  }
  ll ans=0;
  for(int i=1;i<n+1;i++)
  {
    ans+=(arr[i]*(arr[i]-1))/2;
  }
  for(int i=0;i<n;i++)
  {
	ll ans1=ans;
    ans1=ans1-(arr[arr2[i]]*(arr[arr2[i]]-1))/2;
    ans1+=((arr[arr2[i]-1)*(arr[arr2[i]]-2))/2;
    cout<<ans1<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:26: error: expected ']' before ')' token
   30 |     ans1+=((arr[arr2[i]-1)*(arr[arr2[i]]-2))/2;
      |                          ^
      |                          ]
Language: C++

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

#include <map>
using std::map;

#include <string>
using std::string;

int main()
{
    ll n;
    cin >> n;
    map<ll, ll> score;
    vector<ll> data(n);
    for (int i = 0; i < n; i++)
    {
        ll a;
        cin >> a;
        score[a] += 1;
        data[i] = a;
    }

    ll count = 0;
    for (auto x : score)
    {
        ll v = x.second;
        ll u = x.first;

        count += v * (v - 1) / 2;
    }
    for (ll s : data)
    {
        ll count1 = count;
        ll u = score[s];
        count1 -= u * (u - 1) / 2;
        count1 += (u - 1) * (u - 2) / 2;
        cout << count1 << endl;
    }
}f

Compiler output:
a.cc:46:2: error: 'f' does not name a type
   46 | }f
      |  ^
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_upd>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

const LL MOD = 998244353;
const LD EPS = 0.0000001 ;

LL pows(LL a, LL b)
{
	if (b == 0) return 1LL;
	LL temp = pows(a, b / 2);
	temp = (temp * temp) % MOD;
	if (b % 2) temp = (temp * a) % MOD;
	return temp;
}

const LL N = 200000 + 50;
LL cnt[N];

int main(void)
{
	int n; cin >> n;
	int arr[n];
	for (int i = 0; i < n; i++){
		cin >> arr[i];
		cnt[arr[i]]++;
	}

	LL overall = 0;
	for (int i = 1; i < N; i++){
		overall += cnt[i] * (cnt[i] - 1LL) / 2LL;
	}

	for (int i = 0; i < n; i++){
		int who = arr[i];
		LL ans = overall - (cnt[who] * (cnt[who] - 1LL) / 2LL);
		cnt[who]--;
		ans +=  (cnt[who] * (cnt[who] - 1LL) / 2LL)
		cnt[who]++;
		cout << ans << endl;
	}
	
	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:55:60: error: expected ';' before 'cnt'
   55 |                 ans +=  (cnt[who] * (cnt[who] - 1LL) / 2LL)
      |                                                            ^
      |                                                            ;
   56 |                 cnt[who]++;
      |                 ~~~
Language: C++


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define size 200000
#define NUM 998244353
#define ll long long int

int main()
{
  int n;
  cin>>n;
  int arr[n+1];
   for(int i=0;i<n+1++)
     arr[i]=0;
  int arr2[n];
  for(int i=0;i<n;i++)
  {
    cin>>arr2[i];
    arr[arr2[i]]++;
  }
  ll ans=0;
  for(int i=1;i<n+1;i++)
  {
    ans+=(arr[i]*(arr[i]-1))/2;
  }
  for(int i=0;i<n;i++)
  {
	ll ans1=ans;
    ans1=ans1-(arr[arr2[i]]*(arr[arr2[i]]-1))/2;
    ans1+=((arr[arr2[i]-1)*(arr[arr2[i]]-2))/2;
    cout<<ans1<<endl;
  }
}
    
    
 

Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: lvalue required as increment operand
   14 |    for(int i=0;i<n+1++)
      |                    ^
a.cc:14:23: error: expected ';' before ')' token
   14 |    for(int i=0;i<n+1++)
      |                       ^
      |                       ;
a.cc:31:26: error: expected ']' before ')' token
   31 |     ans1+=((arr[arr2[i]-1)*(arr[arr2[i]]-2))/2;
      |                          ^
      |                          ]
Language: C++

#include<stdio.h>

int main(){
    int n,i,j,k = 0,cnt = 0;
    scanf("%d",&n);
    int a[n];
    for(i = 0; i < n; i++){
        scanf("%d",&a[i]);
    }
    for(x = 0; x < n; x++){
        for(i = 0; i < n; i++){
            if(i == k){
                i++;
            }
            for(j = 0; i < n; j++){
                if(k == j){
                    j++;
                }
                if(i == j){
                    j++;
                }
                if(a[i]==a[j]){
                    cnt++;
                }
            }
        printf("%d",cnt);
        cnt = 0;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'x' was not declared in this scope
   10 |     for(x = 0; x < n; x++){
      |         ^
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cfenv>
#include <cmath>
#include <string>
#include <algorithm>
#include <cassert>
#include <functional>
#include <deque>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> cnt(n,0);
  rep(i,n){
    cin >> v[i];
    cnt[v[i]-1]++;
  }

  ll ret = 0;
  rep(i,n){
    ret += cnt[i]*(cnt[i]-1)/2;
  }

  rep(i,n){
    if(cnt[v[i]-1] >){
      cout << ret-cnt[v[i]-1]+1 << endl;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:21: error: expected primary-expression before ')' token
   31 |     if(cnt[v[i]-1] >){
      |                     ^
Language: C++

#include <stdio.h>

int main(void)
{
	int a[200000],s[200000],i,N,j,count[200000],count1=0;
	long long total;
	scanf("%d",&N);
	for(i=0;i<N;i++){
		a[i]=0;
	}
	for(i=0;i<N;i++){
		scanf("%d",&s[i]);
		if(a[s[i]]==1){
			count[count1]=s[i];
			count1++;
		}
		a[s[i]]++;
	}
	for(i=0;i<count1;i++){
		total+=a[count[i]]*(a[count[i]]-1)/2;
	}
	for(i=0;i<N;i++){
		if(a[s[i]]>2)printf("%lld\n",total-a[s[i]]*(a[s[i]])-1)/2+(a[s[i]]-2)*(a[s[i]])-1)/2;
		else printf("%lld\n",total);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:98: error: expected ';' before ')' token
   23 |                 if(a[s[i]]>2)printf("%lld\n",total-a[s[i]]*(a[s[i]])-1)/2+(a[s[i]]-2)*(a[s[i]])-1)/2;
      |                                                                                                  ^
      |                                                                                                  ;
Language: C++

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

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


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define size 200000
#define NUM 998244353
#define ll long long int

int main()
{
  int n;
  cin>>n;
  int arr[n+1];
   for(int i=0;i<n+1++)
     arr[i]=0;
  int arr2[n];
  for(int i=0;i<n;i++)
  {
    cin>>arr2[i];
    arr[arr2[i]]++;
  }
  ll ans=0;
  for(int i=1;i<n+1;i++)
  {
    ans+=(i*(i-1))/2;
  }
  for(int i=0;i<n;i++)
  {
	ll ans1=ans;
    ans1=ans1-(i*(i-1))/2;
    ans1+=((i-1)*(i-2))/2;
    cout<<ans1<<endl;
  }
}
    
    
 

Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: lvalue required as increment operand
   14 |    for(int i=0;i<n+1++)
      |                    ^
a.cc:14:23: error: expected ';' before ')' token
   14 |    for(int i=0;i<n+1++)
      |                       ^
      |                       ;
Language: C++

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

int main(void){
  int N;
  cin >> N;
  int ss[N] = {};
  vector<int>v,u;
  long int ans = 0;
  int a;
  long int max = 0;
  int x,y;
  for(int i = 0; i < N;++i){
    cin >> a;
    v.push_back(a-1);
    ss[a-1]++;
    if(ss[a-1] == 2){
      u.push_back(a-1);
    }
  }

  for(int i:u){
    max += 0.5*ss[i]*(ss[i]-1);
  }
  for(int i = 0; i < N;i++){
    if(ss[v[i]] <= 1){
      ans = max;
    }
    else{
      ans = max - 0.5*ss[v[i]]*(ss[v[i]]-1) + 0.5*(ss[v[i]]-1)*(ss[v[i]]-2);
    }
    cout << aa << endl;
  }
  return 0;
}

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

#include <cstdio>
#include <algorithm>
using namespace std;
static long long int num[200010];
long long int a[200010],b[200010];
long long int i,n;
long long int sum=0;
long long int temp;
int main()
{
    for(i=0;i<200001;i++)
        a[i]=num[i]=0;
    scanf("%lld",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        num[a[i]]++;
    }
    for(i=0;i<n;i++)
        b[i]=a[i];
    sort(b,b+n);
    temp=-1;
    //for(i=0;i<n;i++)
        //printf("%lld %lld\n",a[i],num[a[i]]);
    for(i=0;i<n;i++)
    {
        if(b[i]!=temp)
        {
            sum+=num[b[i]]*(num[b[i]]-1)/2;
            temp=b[i];
        }
    }
    for(i=0;i<n;i++)
        printf("%lld\n",sum-(num[a[i]]-1));
    return 0;
}


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

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

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

#include<bits/stdc++.h>
using namespace std;
int a[100000+10]={0},b[100000+10];
int n;
int he (int s)
{   if(s==0||s==1)  return 0;
    return s*(s-1)/2;    
}
int main ()
{    scanf("%d",&n);
    
   for(int i=1;i<=n;i++)
     {  scanf("%d",&b[i]);
         a[b[i]]++;
	 }
	  long long sum=0;
	 for(int i=1;i<=n;i++)
	   {  //printf("a[i]:%d he[a[i]]:%d\n",a[i],he(a[i]));
	     sum+=he(a[i]);}
	   //printf("sum:%d\n",sum);
	   int h;
	   for(int i=1;i<=n;i++)
	      {   h=sum-he(a[b[i]])+he(a[b[i]]-1);
	         printf("%d\n",h);
		  	  }
		  	  return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector <int> boll(N);
  vector <int> num(N,0);//数字に対応するボールの数
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    ball.at(i) = a;
    num.at(a) += 1;
  }
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += N*(N-1)/2;
  }
  for (int j = 0; j < N; j++) {
    int k = ans;
    long long z = num.at(ball.at(j));
    cout << k - z*(z-1)/2 + (z-1)*(z-2)/2 << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'ball' was not declared in this scope; did you mean 'boll'?
   11 |     ball.at(i) = a;
      |     ^~~~
      |     boll
a.cc:20:26: error: 'ball' was not declared in this scope; did you mean 'boll'?
   20 |     long long z = num.at(ball.at(j));
      |                          ^~~~
      |                          boll
Language: C++

#include <bits/stdc++.h>
#include <map>
using namespace std;
long long C(long long n){
    long long S = 1;
    for(long long i = n; i > n - 2; i--){
        S *= i;
    }
    return S / 2;
}
long long main(void){
    long long N;
    cin >> N;
    vector<long long> A(N);
    for(long long i = 0; i < N; i++) cin >> A[i];
    map<long long,long long> mp;
    for(long long i = 0; i < N; i++){
        if(mp.count(A[i])){
            mp[A[i]]++;
        }
        else mp[A[i]] = 1;
    }
    long long S = 0;
    for(auto p : mp){
        S += C(p.second);
    }
    for(long long i = 0; i < N; i++){
        cout << S - C(mp[A[i]]) + C(mp[A[i]]-1) << endl;
    }
}    

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

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

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 00010];
      | ^~~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin>>n;
      |         ^~~
a.cc:8:22: error: 'b' was not declared in this scope
    8 |                 cin>>b[i];
      |                      ^
a.cc:9:17: error: 'a' was not declared in this scope
    9 |                 a[b[i]]++;
      |                 ^
a.cc:14:37: error: 'a' was not declared in this scope
   14 |                 sum=sum+(long long)(a[i]*(a[i]-1))/2;
      |                                     ^
a.cc:19:17: error: 'cout' was not declared in this scope
   19 |                 cout<<(long long)(sum-(a[b[i]]-1))<<endl;
      |                 ^~~~
a.cc:19:40: error: 'a' was not declared in this scope
   19 |                 cout<<(long long)(sum-(a[b[i]]-1))<<endl;
      |                                        ^
a.cc:19:42: error: 'b' was not declared in this scope
   19 |                 cout<<(long long)(sum-(a[b[i]]-1))<<endl;
      |                                          ^
a.cc:19:53: error: 'endl' was not declared in this scope
   19 |                 cout<<(long long)(sum-(a[b[i]]-1))<<endl;
      |                                                     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int goukei=0,a;
int main(){
  cin>>a;
  vector<int> b(a),c,e;
  for(int i=0;i<a;i++){
    cin>>b[i];
    int d=b[i];
    c[d]++;
  }
  e=c;
  sort(e.begin(),e.end());reverse(e.begin(),e.end());
  int saidai=e[0];
  for(int i=0;i<saidai;i++){
    int g=e[i];
    goukei+=g*(g-1)/2;
  }
  for(int i=0;i<a;i++){
    int d=b[i],f=-1;
    for(int j=0;j<a;j++){
      int g=b[j];
      if(d==g)f++;
      cout<<goukei-f<<endl;
  }
}

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

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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i=0;i < N;i++) {
    cin >> v.at(i);
  }
  for (int k=0;k <N;k++) {
    int count =0;
    for (int i=0;i <N;i++) {
      for (int j=0;j <N;j++) {
        if (k == i) {
          break;
        }
        else if (k == j) {
          continue
        }
        else if (v.at(i) != v.at(j)) {
          count++;
        }
      }
    }
    cout << count << endl;
  }
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: expected ';' before '}' token
   19 |           continue
      |                   ^
      |                   ;
   20 |         }
      |         ~
Language: C++

#include<bits/stdc++.h>
#define mp   make_pair
typedef long long ll;
using namespace std;
int main(){
    map<ll,ll>cnt,cnt1,diff;
    ll n,i;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
        cnt[a[i]]++;
    }
    long long ans=0;
    for(auto p:cnt){
        cnt[p.first] = (p.second*(p.second-1))/2;
        cnt1[p.first] = (p.second-1)*(p.second-2)/2;
        diff[p.first] = max(0,cnt[p.first]-cnt1[p.first]);
        //cout<<p.first<<" "<<p.second<<"\n";
        ans+=cnt[p.first];
    }
    for(i=0;i<n;i++){
        ll res;
        res=ans-diff[a[i]];
        cout<<res<<"\n";
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:28: error: no matching function for call to 'max(int, std::map<long long int, long long int>::mapped_type)'
   18 |         diff[p.first] = max(0,cnt[p.first]-cnt1[p.first]);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:18:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::map<long long int, long long int>::mapped_type' {aka 'long long int'})
   18 |         diff[p.first] = max(0,cnt[p.first]-cnt1[p.first]);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:18:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   18 |         diff[p.first] = max(0,cnt[p.first]-cnt1[p.first]);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~