Language: C++

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

P ab(int n){
  int a = n%10;
  int b = n%10;
  while(n/10 != 0){
    n = n/10;
    a = n;
  }
  P p(a,b);
  return p;
}

int main(){
  int n;
  cin >> n;
  vector<P> ans(n);
  rep(i,n){
    ans[i-1] = ab(i);
  }
  map<P,int> count;
  rep(i,9){
    rep(j,9){
      P pair1(i,j);
      count[pair1] = 0;
    }
  }
  //<1,1>~<9,9>の数を数える
  rep(i,n){
    count[ans[i-1]]++;
  }
  ll answer = 0;
  rep(i,9){
    rep(j,9){
      P pair1(i,j);
      P pair2(j,i);
      if (i==j)
      	answer = answer + count.at(pair1)*count.at(pair2);
      else
        answer = answer + count.at(pair1)*count.at(pair2);
    }
  }
  cout << answer << endl;
}




Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc:5:11: error: 'pair' does not name a type
    5 | using P = pair<int,int>;
      |           ^~~~
a.cc:7:1: error: 'P' does not name a type
    7 | P ab(int n){
      | ^
a.cc: In function 'int main()':
a.cc:20:3: error: 'cin' was not declared in this scope
   20 |   cin >> n;
      |   ^~~
a.cc:21:3: error: 'vector' was not declared in this scope
   21 |   vector<P> ans(n);
      |   ^~~~~~
a.cc:21:10: error: 'P' was not declared in this scope
   21 |   vector<P> ans(n);
      |          ^
a.cc:21:13: error: 'ans' was not declared in this scope
   21 |   vector<P> ans(n);
      |             ^~~
a.cc:23:16: error: 'ab' was not declared in this scope
   23 |     ans[i-1] = ab(i);
      |                ^~
a.cc:25:3: error: 'map' was not declared in this scope
   25 |   map<P,int> count;
      |   ^~~
a.cc:25:9: error: expected primary-expression before 'int'
   25 |   map<P,int> count;
      |         ^~~
a.cc:28:8: error: expected ';' before 'pair1'
   28 |       P pair1(i,j);
      |        ^~~~~~
      |        ;
a.cc:29:7: error: 'count' was not declared in this scope
   29 |       count[pair1] = 0;
      |       ^~~~~
a.cc:29:13: error: 'pair1' was not declared in this scope
   29 |       count[pair1] = 0;
      |             ^~~~~
a.cc:34:5: error: 'count' was not declared in this scope
   34 |     count[ans[i-1]]++;
      |     ^~~~~
a.cc:39:8: error: expected ';' before 'pair1'
   39 |       P pair1(i,j);
      |        ^~~~~~
      |        ;
a.cc:40:8: error: expected ';' before 'pair2'
   40 |       P pair2(j,i);
      |        ^~~~~~
      |        ;
a.cc:42:27: error: 'count' was not declared in this scope
   42 |         answer = answer + count.at(pair1)*count.at(pair2);
      |                           ^~~~~
a.cc:42:36: error: 'pair1' was not declared in this scope
   42 |         answer = answer + count.at(pair1)*count.at(pair2);
      |                                    ^~~~~
a.cc:42:52: error: 'pair2' was not declared in this scope
   42 |         answer = answer + count.at(pair1)*count.at(pair2);
      |                                                    ^~~~~
a.cc:44:27: error: 'count' was not declared in this scope
   44 |         answer = answer + count.at(pair1)*count.at(pair2);
      |                           ^~~~~
a.cc:44:36: error: 'pair1' was not declared in this scope
   44 |         answer = answer + count.at(pair1)*count.at(pair2);
      |                                    ^~~~~
a.cc:44:52: error: 'pair2' was not declared in this scope
   44 |         answer = answer + count.at(pair1)*count.at(pair2);
      |                                                    ^~~~~
a.cc:47:3: error: 'cout' was not declared in this scope
   47 |   cout << answer << endl;
      |   ^~~~
a.cc:47:21: error: 'endl' was not declared in this scope
   47 |   cout << answer << endl;
      |                     ^~~~