Language: C++

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll int n;
    cin >> n;
    ll int a[n];
    for (ll int i = 0 ; i < n ; i++) cin >> a[i];
    map <ll int, ll int> m;
    for (ll int i = 0 ; i < n ; i++) m[a[i]]++;
    ll int b[n];
    ll int cnt = 0;
    map <int, bool> c;
    for (ll int i = 0 ; i < n ; i++) {
    	c[a[i]] = true;
	}
	for (ll int i = 1 ; i <= 200000 ; i++) {
		if (c[i] == true) {
			b[cnt] = i;
			cnt++;
		}
	}
	ll int sum = 0;
	for (ll int j = 0 ; j < cnt ; j++) {
		if (m[b[j]] == 0 || m[b[j]] == 1) continue;
		else sum += m[b[j]] * (m[b[j]]-1) / 2;
	}
	for (ll int i = 0 ; i < n ; i++) {
		int x = a[i];
		if (m[x] == 1) {
			cout << sum << endl;
		} else {
			cout << sum - m[x] + 1 << endl;
		}
	}
}
/*
5
4 4 5 4 5
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'll' was not declared in this scope
    8 |     ll int n;
      |     ^~
a.cc:9:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    9 |     cin >> n;
      |            ^
      |            yn
a.cc:10:7: error: expected ';' before 'int'
   10 |     ll int a[n];
      |       ^~~~
      |       ;
a.cc:11:12: error: expected ';' before 'int'
   11 |     for (ll int i = 0 ; i < n ; i++) cin >> a[i];
      |            ^~~~
      |            ;
a.cc:11:25: error: 'i' was not declared in this scope
   11 |     for (ll int i = 0 ; i < n ; i++) cin >> a[i];
      |                         ^
a.cc:11:45: error: 'a' was not declared in this scope
   11 |     for (ll int i = 0 ; i < n ; i++) cin >> a[i];
      |                                             ^
a.cc:12:24: error: wrong number of template arguments (1, should be at least 2)
   12 |     map <ll int, ll int> m;
      |                        ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:13:12: error: expected ';' before 'int'
   13 |     for (ll int i = 0 ; i < n ; i++) m[a[i]]++;
      |            ^~~~
      |            ;
a.cc:13:25: error: 'i' was not declared in this scope
   13 |     for (ll int i = 0 ; i < n ; i++) m[a[i]]++;
      |                         ^
a.cc:13:40: error: 'a' was not declared in this scope
   13 |     for (ll int i = 0 ; i < n ; i++) m[a[i]]++;
      |                                        ^
a.cc:14:7: error: expected ';' before 'int'
   14 |     ll int b[n];
      |       ^~~~
      |       ;
a.cc:15:7: error: expected ';' before 'int'
   15 |     ll int cnt = 0;
      |       ^~~~
      |       ;
a.cc:17:12: error: expected ';' before 'int'
   17 |     for (ll int i = 0 ; i < n ; i++) {
      |            ^~~~
      |            ;
a.cc:17:25: error: 'i' was not declared in this scope
   17 |     for (ll int i = 0 ; i < n ; i++) {
      |                         ^
a.cc:18:11: error: 'a' was not declared in this scope
   18 |         c[a[i]] = true;
      |           ^
a.cc:20:16: error: expected ';' before 'int'
   20 |         for (ll int i = 1 ; i <= 200000 ; i++) {
      |                ^~~~
      |                ;
a.cc:20:29: error: 'i' was not declared in this scope
   20 |         for (ll int i = 1 ; i <= 200000 ; i++) {
      |                             ^
a.cc:22:25: error: 'b' was not declared in this scope
   22 |                         b[cnt] = i;
      |                         ^
a.cc:22:27: error: 'cnt' was not declared in this scope; did you mean 'int'?
   22 |                         b[cnt] = i;
      |                           ^~~
      |                           int
a.cc:26:11: error: expected ';' before 'int'
   26 |         ll int sum = 0;
      |           ^~~~
      |           ;
a.cc:27:16: error: expected ';' before 'int'
   27 |         for (ll int j = 0 ; j < cnt ; j++) {
      |                ^~~~
      |                ;
a.cc:27:29: error: 'j' was not declared in this scope
   27 |         for (ll int j = 0 ; j < cnt ; j++) {
      |                             ^
a.cc:27:33: error: 'cnt' was not declared in this scope; did you mean 'int'?
   27 |         for (ll int j = 0 ; j < cnt ; j++) {
      |                                 ^~~
      |                                 int
a.cc:28:23: error: 'b' was not declared in this scope
   28 |                 if (m[b[j]] == 0 || m[b[j]] == 1) continue;
      |                       ^
a.cc:29:22: error: 'sum' was not declared in this scope
   29 |                 else sum += m[b[j]] * (m[b[j]]-1) / 2;
      |                      ^~~
a.cc:31:16: error: expected ';' before 'int'
   31 |         for (ll int i = 0 ; i < n ; i++) {
      |                ^~~~
      |                ;
a.cc:31:29: error: 'i' was not declared in this scope
   31 |         for (ll int i = 0 ; i < n ; i++) {
      |                             ^
a.cc:32:25: error: 'a' was not declared in this scope
   32 |                 int x = a[i];
      |                         ^
a.cc:33:22: error: invalid types 'int[int]' for array subscript
   33 |                 if (m[x] == 1) {
      |                      ^
a.cc:34:33: error: 'sum' was not declared in this scope
   34 |                         cout << sum << endl;
      |                                 ^~~
a.cc:36:33: error: 'sum' was not declared in this scope
   36 |                         cout << sum - m[x] + 1 << endl;
      |                                 ^~~
a.cc:36:40: error: invalid types 'int[int]' for array subscript
   36 |                         cout << sum - m[x] + 1 << endl;
      |                                        ^