Language: C++

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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}


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

  lint sum=0;
  map<lint,lint> mp;
  for(lint i=0;i<n;i++) { mp[a[i]]++; }
  for(map<lint,lint>::iterator i=mp.begin();i!=mp.end();i++) { sum += i->second*(i->second-1)/2; }

  for(lint i=0;i<n;i++) { cout << sum-(mp[a[i]]-1) << endl; }

  return 0;
}


Compiler output:
a.cc:3:1: error: expected initializer before 'using'
    3 | using namespace std;
      | ^~~~~
a.cc:5:1: error: 'lint' does not name a type; did you mean 'uint'?
    5 | lint gcd(lint x, lint y) {
      | ^~~~
      | uint
a.cc:10:1: error: 'lint' does not name a type; did you mean 'uint'?
   10 | lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }
      | ^~~~
      | uint
a.cc:12:1: error: 'lint' does not name a type; did you mean 'uint'?
   12 | lint C(lint n, lint k) {
      | ^~~~
      | uint
a.cc: In function 'int main()':
a.cc:22:3: error: 'lint' was not declared in this scope; did you mean 'uint'?
   22 |   lint n; cin >> n;
      |   ^~~~
      |   uint
a.cc:22:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   22 |   lint n; cin >> n;
      |           ^~~
      |           std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:22:18: error: 'n' was not declared in this scope; did you mean 'yn'?
   22 |   lint n; cin >> n;
      |                  ^
      |                  yn
a.cc:23:3: error: 'vector' was not declared in this scope
   23 |   vector<lint> a(n); for(lint i=0;i<n;i++) { cin >> a[i]; }
      |   ^~~~~~
a.cc:23:3: 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:23:16: error: 'a' was not declared in this scope
   23 |   vector<lint> a(n); for(lint i=0;i<n;i++) { cin >> a[i]; }
      |                ^
a.cc:23:30: error: expected ';' before 'i'
   23 |   vector<lint> a(n); for(lint i=0;i<n;i++) { cin >> a[i]; }
      |                              ^~
      |                              ;
a.cc:23:35: error: 'i' was not declared in this scope
   23 |   vector<lint> a(n); for(lint i=0;i<n;i++) { cin >> a[i]; }
      |                                   ^
a.cc:25:7: error: expected ';' before 'sum'
   25 |   lint sum=0;
      |       ^~~~
      |       ;
a.cc:26:3: error: 'map' was not declared in this scope
   26 |   map<lint,lint> mp;
      |   ^~~
a.cc:26:3: note: suggested alternatives:
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152:
/usr/include/c++/14/bits/stl_map.h:102:11: note:   'std::map'
  102 |     class map
      |           ^~~
/usr/include/c++/14/map:89:13: note:   'std::pmr::map'
   89 |       using map
      |             ^~~
a.cc:26:18: error: 'mp' was not declared in this scope
   26 |   map<lint,lint> mp;
      |                  ^~
a.cc:27:11: error: expected ';' before 'i'
   27 |   for(lint i=0;i<n;i++) { mp[a[i]]++; }
      |           ^~
      |           ;
a.cc:27:16: error: 'i' was not declared in this scope
   27 |   for(lint i=0;i<n;i++) { mp[a[i]]++; }
      |                ^
a.cc:28:23: error: '::iterator' has not been declared; did you mean 'std::iterator'?
   28 |   for(map<lint,lint>::iterator i=mp.begin();i!=mp.end();i++) { sum += i->second*(i->second-1)/2; }
      |                       ^~~~~~~~
      |                       std::iterator
In file included from /usr/include/c++/14/bits/stl_algobase.h:65,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_iterator_base_types.h:127:34: note: 'std::iterator' declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
a.cc:28:45: error: 'i' was not declared in this scope
   28 |   for(map<lint,lint>::iterator i=mp.begin();i!=mp.end();i++) { sum += i->second*(i->second-1)/2; }
      |                                             ^
a.cc:28:64: error: 'sum' was not declared in this scope
   28 |   for(map<lint,lint>::iterator i=mp.begin();i!=mp.end();i++) { sum += i->second*(i->second-1)/2; }
      |                                                                ^~~
a.cc:30:11: error: expected ';' before 'i'
   30 |   for(lint i=0;i<n;i++) { cout << sum-(mp[a[i]]-1) << endl; }
      |           ^~
      |           ;
a.cc:30:16: error: 'i' was not declared in this scope
   30 |   for(lint i=0;i<n;i++) { cout << sum-(mp[a[i]]-1) << endl; }
      |                ^
a.cc:30:27: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   30 |   for(lint i=0;i<n;i++) { cout << sum-(mp[a[i]]-1) << endl; }
      |                           ^~~~
      |                           std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:30:35: error: 'sum' was not declared in this scope
   30 |   for(lint i=0;i<n;i++) { cout << sum-(mp[a[i]]-1) << endl; }
      |                                   ^~~
a.cc:30:55: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   30 |   for(lint i=0;i<n;i++) { cout << sum-(mp[a[i]]-1) << endl; }
      |                                                       ^~~~
      |                                                       std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~