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

#include <iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	int a[N];
	int b[N];
	int sum = 0;
	for (int i = 1; i < N; i++) {
		for (int j = 1; j < N; j++) {
			a[i] = i;
			b[j] = j;
		}
	}
	for (int i = 1; i < N; i++) {
		for (int j = 1; j < N; j++) {
			if ((a[i] / 10 == b[j] % 10) || (a[i] % 10 == b[j] / 10) {
				sum++;
			}
		}
	}
	cout <<sum;
	return 0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:81: error: expected ')' before '{' token
   17 |                         if ((a[i] / 10 == b[j] % 10) || (a[i] % 10 == b[j] / 10) {
      |                            ~                                                    ^~
      |                                                                                 )
a.cc:20:17: error: expected primary-expression before '}' token
   20 |                 }
      |                 ^
a.cc:23:17: error: expected ';' before '}' token
   23 |         return 0
      |                 ^
      |                 ;
   24 | }
      | ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int matsu(int a);
int sento(int a);
int main(){
  int N=0,cnt=0,Num[10],degit;string Ns;
  cin >> Ns;
  for(int i = 0; i < Ns.size(); i++){
    N *= 10;
    N += Ns[i] - '0';
    Num[i] = Ns[i] - '0';
  }
  degit = Ns.size();
  if(degit == 1) {cout << N;return 0;}
  if(degit == 2 || degit == 3) {
    for(int i = 1; i <= N; i++){
      for(int j = 1; j <= N; j++){
        if(matsu(i)==sento(j) && matsu(j) == sento(i) ) cnt++;
      }
    }
    cout << cnt;
    return 0;
  }
  for(int i = 1; i<=N; i++){
    if(i % 10 != 0){
      int s = sento(i),m = matsu(i);
      if(s == m) cnt++;
      for(int j = 2; j <=degit;j++){
        if(j==degit){
          if( sento(N) > m ){
            int tmp=1;
            for(int k = 0; k < degit - 2; k++){
              tmp *= 10;
            }
            if(degit - 2==0) cnt--;
            cnt += tmp;
          }
          else if(  sento(N) == m ){
            int tmp = 1;
            for(int k = 2; k <= degit; k++){
              tmp *= (Num[k] + 1)
            }
            if(degit - 2==0) cnt--;
            cnt += tmp;
          }
        }
        else{
          int tmp = 1;
          for(int k = 0; k < j - 2; k++){
            tmp *= 10;
          }
          cnt += tmp;
        }
      }
    }
  }
  cout << cnt;
  return 0;
}
int matsu(int a){
  return a % 10;
}
int sento(int a){
  int b = 1;
  while(a / b > 10){
    b *= 10;
  }
  return a / b;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:34: error: expected ';' before '}' token
   42 |               tmp *= (Num[k] + 1)
      |                                  ^
      |                                  ;
   43 |             }
      |             ~
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  map<pll,ll> p;
  for(int i=1;i<=n;i++){
    ll k=i;
    ll cu=0;
    while(k/10!=0){
      k/=10;
      cu++;
    }
    ll j=1;
    rep(g,cu) j*=10;
    if(i%j==0) continue;
    p[pll(k,i%j)]++;
  }
  for(int i=1;i<10;i++){
    for(int j=1;j<=9;j++){
      p[pll(i,j)]+=0;
    }
  }
  ans=0;
  for(int i=1;i<10;i++){
    for(int j=i;j<10;j++){
      ans+=p[pll(i,j)]*p[pll(j,i)];
    }
  }
  COUT(ans);
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:63:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   63 |   ans=0;
      |   ^~~
      |   abs
Language: C++

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

int maxnum(int n){
  while(n > 9){
    n /= 10;
  }
  return n;
}

int minnum(int n){
  return n % 10;
}

int main(void){
  int N;
  cin >> N;
  
  vector<vector<int>>num(10,vector<int>(10,0));
  for(int i=0;i<=N;i++){
    num[maxnum[i]][minnum[i]]++;
  }
  
  long long ans = 0;
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      ans += num[i][j] * num[j][i];
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   22 |     num[maxnum[i]][minnum[i]]++;
      |                 ^
a.cc:22:17: error: invalid conversion from 'int (*)(int)' to 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-fpermissive]
   22 |     num[maxnum[i]][minnum[i]]++;
      |         ~~~~~~~~^
      |                 |
      |                 int (*)(int)
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   initializing argument 1 of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; reference = std::vector<int>&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
a.cc:22:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   22 |     num[maxnum[i]][minnum[i]]++;
      |                            ^
a.cc:22:28: error: invalid conversion from 'int (*)(int)' to 'std::vector<int>::size_type' {aka 'long unsigned int'} [-fpermissive]
   22 |     num[maxnum[i]][minnum[i]]++;
      |                    ~~~~~~~~^
      |                            |
      |                            int (*)(int)
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   initializing argument 1 of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
Language: C++

n = int(input())

cnt = [[0]*10 for i in range(10)]

for i in range(1,n+1):
    s = str(i)
    cnt[int(s[0])][int(s[-1])] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += cnt[i][j] * cnt[j][i]

print(ans)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 2e5+10;
ll n,ans,d[20][20],k;
int main () {
    cin >> n;
    for(ll i=1;i<=n;++i) {
        for(k=i;j>=10;k/=10);
        d[k][i%10]++;
    }
    for(int i=1;i<=9;++i) {
        for(int j=1;j<=9;++j) {
            ans+=d[i][j]*d[j][i];
        }
    }
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'j' was not declared in this scope
   10 |         for(k=i;j>=10;k/=10);
      |                 ^
Language: C++

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
typedef pair<int, int> P;

int64 gcd(int64 a, int64 b) {
    return b != 0 ? gcd(b, a % b) : a;
}

int64 lcm(int64 a, int64 b) {
		return a / gcd(a, b) * b;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

P f(int n) {
	int a = n % 10;
	int b;
	rep (n > 0) {
		b = n;
		n /= 10;
	}
	return P(b, a);
}

void solve() {
		int n; cin >> n;
		map<P, int> freq;
		repr (i, n) {
			P p = f(n);	
			freq[p]++;
		}
		int64 ans = 0;
		repr (i, n) {
			P p = f(n);
			ans += freq[p];
		}
		cout << ans << endl;
    return;
}

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



Compiler output:
a.cc:67:19: error: macro "rep" requires 2 arguments, but only 1 given
   67 |         rep (n > 0) {
      |                   ^
a.cc:22:9: note: macro "rep" defined here
   22 | #define rep(i, x) for (int i = 0; i < (int)(x); i++)
      |         ^~~
a.cc: In function 'P f(int)':
a.cc:67:9: error: 'rep' was not declared in this scope
   67 |         rep (n > 0) {
      |         ^~~
Language: C++

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

int get_top(int n){
  int c=1;
  while(1<n){
    n /= 10;
    c++;
  }
  int top;
  top = n/(std::pow(10,(c-1)));
  return(top);
}

int get_tail(int n){
  return(n%10);
}

int main() {
  int N;
  cin >> N;
  int count = 0;
  for(int i=0; i<10; i++){
    for(int j=0; j<10; j++){
      int a = 0;
      int b = 0;
      for(int i=0; i<N; i++){
        m = i+1
        if((get_top(m) = i)&&(get_tail(m) == j)){
          a++;
        }
        if((get_tail(m) = i)&&(get_top(m) == j)){
          b++;
        }
      }
      count += a*b
    }
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'm' was not declared in this scope
   28 |         m = i+1
      |         ^
a.cc:36:19: error: expected ';' before '}' token
   36 |       count += a*b
      |                   ^
      |                   ;
   37 |     }
      |     ~
Language: C++

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

typedef long long ll;
typedef pair<int,int>P;

P func(int n){
        int a=n%10,b;
        while(n){
                b=n;
                n/=10;
        }
        return P(a,b);
}

int main(){
        int n;
        cin>>n;
        map<P,int>mp;
        for(int i=1;i<=n;i++){
                mp[func(i)]++;
        }
        ll ans=0;
                                                              1,9          先頭


Compiler output:
a.cc: In function 'int main()':
a.cc:24:66: error: expected ';' before '\U00005148\U0000982d'
   24 |                                                               1,9          先頭
      |                                                                  ^         ~~~~
      |                                                                  ;
a.cc:24:80: error: expected '}' at end of input
   24 |                                                               1,9          先頭
      |                                                                                ^
a.cc:16:11: note: to match this '{'
   16 | int main(){
      |           ^
Language: Java


import java.util.Scanner;

public class Virtual04 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        int ans = 0;
        for (int i = 1; a >= i; i++) {
            String iString = String.valueOf(i);

            String iStringPrefix = iString.substring(0, 1);
            int iPrefix = Integer.parseInt(iStringPrefix);

            String iStringSuffix = iString.substring(iString.length() - 1);
            int iSuffix = Integer.parseInt(iStringSuffix);

            //System.out.println(i + "/" + iPrefix + "/" + iSuffix);

            for (int j = 1; a >= j; j++) {
                String jString = String.valueOf(j);

                String jStringPrefix = jString.substring(0, 1);
                int jPrefix = Integer.parseInt(jStringPrefix);

                if (iSuffix == jPrefix) {
                    String jStringSuffix = jString.substring(jString.length() - 1);
                    int jSuffix = Integer.parseInt(jStringSuffix);

                    if (iPrefix == jSuffix) {
                        ans++;
                    }
                }
            }
        }
        System.out.println(ans);
    }
}

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

#include<stdio.h>
int main()
{
  int N,i,j,m;
  int k=0;
  int number1,number2;
  int digit1,digit2;
  int oral1,oral2;
  scanf("%d",&N);
  for(i=1;i<N;i++){
    digit1=0;
    number1=i;
    oral1=i;
    while(number1!=0){
    number1 = i / 10;
    digit1++;
  }
    digit1=digit1-1;
    if(digit1!=0){
    for(m=0;m<digit1;m++){
      oral1=0ral1/10;
    }
    }
    
    for(j=1;j<N;j++){
     digit2=0;
    number2=j;
      oral2=j;
    while(number2!=0){
    number2 = j / 10;
    digit2++;
  }
    digit2=digit2-1;
    if(digit2!=0){
    for(m=0;m<digit2;m++){
      oral2=oral2/10;
    }
    }
      if((i%10==oral2)&&(j%10==oral1)){
        k++;
      }
    }
  }
  printf("%d",k);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:21:13: error: invalid suffix "ral1" on integer constant
   21 |       oral1=0ral1/10;
      |             ^~~~~
Language: C

#include<stdio.h>
int main()
{
  int N,i,j,m;
  int k=0;
  int number1,numer2;
  int digit11,digit2;
  scanf("%d",&N);
  for(i=1;i<N;i++){
    digit1=0;
    number1=i;
    while(number1!=0){
    number1 = i / 10;
    digit1++;
  }
    digit1=digit1-1;
    number1=i;
    if(digit1!=0){
    for(m=0;m<digit1;m++){
      number1=number1/10;
    }
    }
    
    for(j=1;j<N;j++){
     digit2=0;
    number2=i;
    while(number2!=0){
    number2 = j / 10;
    digit2++;
  }
    digit2=digit2-1;
    number2=j;
    if(digit2!=0){
    for(m=0;m<digit2;m++){
      number2=number2/10;
    }
    }
      if((i%10==number2)&&(j%10==number1)){
        k++:
      }
    }
  }
  printf("%d",k);
  return 0;
}
  


Compiler output:
main.c: In function 'main':
main.c:10:5: error: 'digit1' undeclared (first use in this function); did you mean 'digit2'?
   10 |     digit1=0;
      |     ^~~~~~
      |     digit2
main.c:10:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:5: error: 'number2' undeclared (first use in this function); did you mean 'numer2'?
   26 |     number2=i;
      |     ^~~~~~~
      |     numer2
main.c:39:12: error: expected ';' before ':' token
   39 |         k++:
      |            ^
      |            ;
Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp14
{
    class Program
    {
        static void Main(string[] args)
        {
            var solver = new Solver();
            solver.Calc();
        }
    }

    public class Solver
    {


        public void Calc()
        {
            var N = int.Parse(Console.ReadLine());


            var dic = new Dictionary<char, Dictionary<char, int>>();

            for (var a = 1; a <= 9; a++)
            {

                var chi = new Dictionary<char, int>();
                dic.Add(a.ToString()[0], chi);
                for (var b = 1; b <= 9; b++)
                {
                    chi.Add(b.ToString()[b.ToString().Length - 1], 0);
                }
            }
            for (var a = 1; a <= N; a++)
            {
                if (a.ToString()[a.ToString().Length - 1] != '0')
                {
                    dic[a.ToString()[0]][a.ToString()[a.ToString().Length - 1]]++;
                }
            }

            var count = 0;
            for (var a = 1; a <= N; a++)
            {
                if (a.ToString()[a.ToString().Length - 1] != '0')
                {
                    count += dic[a.ToString()[a.ToString().Length - 1]][a.ToString()[0]];
                }
            }


            Console.WriteLine(count);

        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:10:26: error: 'string' has not been declared
   10 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:10:35: error: expected ',' or '...' before 'args'
   10 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:15:6: error: expected ';' after class definition
   15 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void ConsoleApp14::Program::Main(int*)':
a.cc:12:13: error: 'var' was not declared in this scope
   12 |             var solver = new Solver();
      |             ^~~
a.cc:13:13: error: 'solver' was not declared in this scope
   13 |             solver.Calc();
      |             ^~~~~~
a.cc: At global scope:
a.cc:17:5: error: expected unqualified-id before 'public'
   17 |     public class Solver
      |     ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int N;
    scanf("%d", &N);

    int counts[9][9]; // first and last can only be 1-9 since there are no leading 0s

    memset(counts, 0, sizeof(counts));

    for(int i=1; i <= N; i++){

        int first = to_string(i)[0] - '0';
        int last = i % 10;

        if(first == 0 || last == 0)
            continue;

        counts[first][last]++;

    }

    long long ans = 0;
    
    for(int i=0; i < 10; i++){
        for(int j=0; j < 10; j++){
            ans += counts[i][j] * s[j][i]; // first one has counts[i][j] choices, while the second one has counts[j][i] choices. So total for (a, b) there are counts[i][j] * counts[j][i] choices
        }
    }

    printf("%lld", ans);

}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:35: error: 's' was not declared in this scope
   33 |             ans += counts[i][j] * s[j][i]; // first one has counts[i][j] choices, while the second one has counts[j][i] choices. So total for (a, b) there are counts[i][j] * counts[j][i] choices
      |                                   ^
Language: C++

#define rep(i,n) for (int i =0;i<n;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

P f(int x){
  int a = x%10;
  int b = 0;
  while(x){
    b = x;
    x/=10;
  }
  return P(a,b);
}

int main(){
  int n,ans=0;
  P p,q;
  map <P,int> freq;
  cin >> n;
  for(int i = 1;i<n;i++){
    p = f(i);
    freq[p]++;
  }
  for (int i = 1;i<n;i++){
    p = f(i);
    q = P(p.second,p.first);
    ans+=freq[q];
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:4:11: error: 'pair' does not name a type
    4 | using P = pair<int,int>;
      |           ^~~~
a.cc:6:1: error: 'P' does not name a type
    6 | P f(int x){
      | ^
a.cc: In function 'int main()':
a.cc:18:3: error: 'P' was not declared in this scope
   18 |   P p,q;
      |   ^
a.cc:19:3: error: 'map' was not declared in this scope
   19 |   map <P,int> freq;
      |   ^~~
a.cc:1:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
  +++ |+#include <map>
    1 | #define rep(i,n) for (int i =0;i<n;i++)
a.cc:19:10: error: expected primary-expression before 'int'
   19 |   map <P,int> freq;
      |          ^~~
a.cc:20:3: error: 'cin' was not declared in this scope
   20 |   cin >> n;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define rep(i,n) for (int i =0;i<n;i++)
a.cc:22:5: error: 'p' was not declared in this scope
   22 |     p = f(i);
      |     ^
a.cc:22:9: error: 'f' was not declared in this scope
   22 |     p = f(i);
      |         ^
a.cc:23:5: error: 'freq' was not declared in this scope
   23 |     freq[p]++;
      |     ^~~~
a.cc:26:5: error: 'p' was not declared in this scope
   26 |     p = f(i);
      |     ^
a.cc:26:9: error: 'f' was not declared in this scope
   26 |     p = f(i);
      |         ^
a.cc:27:5: error: 'q' was not declared in this scope
   27 |     q = P(p.second,p.first);
      |     ^
a.cc:28:10: error: 'freq' was not declared in this scope
   28 |     ans+=freq[q];
      |          ^~~~
a.cc:30:3: error: 'cout' was not declared in this scope
   30 |   cout << ans << endl;
      |   ^~~~
a.cc:30:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:18: error: 'endl' was not declared in this scope
   30 |   cout << ans << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define rep(i,n) for (int i =0;i<n;i++)
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class D_Handstand {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int N=Integer.parseInt(br.readLine());
        int[][] c=new int[10][10];
        int sum=0; int mid=0;
        for(int p=1;p<10;p++){
            for(int s=1;s<10;s++){
                for(int i=0;i<=N;i++){
                    String str=i+"";
                    if(str.substring(0,1).equals(p+"") 
                            && str.substring(str.length()-1,str.length()).equals(s+"")){
                        c[p][s]++;
                    }
                }
                
            }
        }
        for(int p=1;p<10;p++){
            for (int i = 1; i < 10; i++) {
                sum+=c[p][i]*c[i][p];
            }
        }
        System.out.println(sum);
    }
    
}

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

#include <bits/stdc++.h>

int get_first(int x) {
  int remainder;
  while (true) {
    remainder = x % 10;
	x /= 10;
    if (x == 0) break;
  }
  return remainder;
}

int get_digits(int n) { int count=0; while (n) n /= 10; return count; }

int main() {
  int n;
  int count = 0;
  std::cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n;) {
      if (get_first(i) != (j%10)) {
        j++;
        continue;
      }
      if (get_first(j) != (i%10)) {
        j += (get_digits(j) * 10);
        continue;
      }
      if (i == j) count++;
      else count += 2;
      if (get_first(i)2;
    }
  }
  std::cout << count << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:23: error: expected ';' before numeric constant
   31 |       if (get_first(i)2;
      |                       ^
      |                       ;
a.cc:32:5: error: expected primary-expression before '}' token
   32 |     }
      |     ^
a.cc:31:25: error: expected ')' before '}' token
   31 |       if (get_first(i)2;
      |          ~              ^
      |                         )
   32 |     }
      |     ~                    
a.cc:32:5: error: expected primary-expression before '}' token
   32 |     }
      |     ^
Language: C++

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define int long long


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n; cin >> n;

    int ans = 0;

    for(int a = 1;a <= n;a ++){

        int f,e;
        e = a % 10;

        if(e == 0) continue;
        f = a;

        while(f >= 10){
            f /= 10;
        }
        int b = e;
        if(e == f){
            ans ++;
        }

        for(int i = 1;i <= 5;i ++){
            b = e * pow(10,i);
            b += f;
            if(b > n) break;

            if(10 <= b && b <= 99){
                ans ++;
            }else if(100 <= b && b <= 999){
                for(int j = 0;j < 10;j ++){
                    ans ++;
                    b += 10;
                    if(b > n) break;
                }
            }else if(1000 <= b && b <= 9999){
                for(int j = 0;j < 100;j ++){
                    ans ++;
                    b += 10;
                    if(b > n) break;
                }
            }else if(10000 <= b && b <= 99999){
                for(int j = 0;j < 1000;j ++){
                    ans ++;
                    b += 10;
                    if(b > n) break;
                }
            }else{
                for(int j = 0;j < 10000;j ++){
                    ans ++;
                    b += 10;
                    if(b > n) break;
                }
            }
        }
    }

    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:21: error: 'pow' was not declared in this scope
   47 |             b = e * pow(10,i);
      |                     ^~~
Language: C++

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

int main(){
  int n;
  cin >> n;
  int a[10][10];
  auto first = [](int x){int y = 0; while(x) {y = x % 10, x /= 10;} return y};
  memset(a, 0, sizeof a);
  long long ans = 0;
  for(int i = 1; i < n; ++i) 
    a[first(i)][j%10] += 1;
  
  for(int i = 1; i < 10; ++i){
  	for(int j = 1; j < 10; ++j){
      ans += (a[i][j] * a[j][i]);
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:8:77: error: expected ';' before '}' token
    8 |   auto first = [](int x){int y = 0; while(x) {y = x % 10, x /= 10;} return y};
      |                                                                             ^
      |                                                                             ;
a.cc: In function 'int main()':
a.cc:12:17: error: 'j' was not declared in this scope
   12 |     a[first(i)][j%10] += 1;
      |                 ^
Language: C++

#include <iostream>

using namespace std;

int
main()
{
  int N;
  cin >> N;
  int fl[10][10] = {0};
  for (int i = 1; i <= N; ++i) {
    int f,l;
    if (i < 10) {
      f i;
    }
    else if (i >= 10 && i < 100) {
      f = (int)i / 10;
    }
    else if (i >= 100 && i < 1000) {
      f = (int)i / 100;
    }
    else if (i >= 1000 && i < 10000) {
      f = (int)i / 1000;
    }
    else if (i >= 10000 && i < 100000) {
      f = (int)i / 10000;
    }
    else /* i >= 100000 */ {
      f = (int)i / 100000;
    }
    l = i % 10;
    fl[f][l]++;
  }
  int s = 0;
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      s += fl[i][j] * fl[j][i];
    }
  }
  cout << s << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:8: error: expected ';' before 'i'
   14 |       f i;
      |        ^~
      |        ;
Language: C++

#include <iostream>

using namespace std;

int
main()
{
  int N;
  cin >> N;
  int fl[10][10] = {0}
  for (int i = 1; i <= N; ++i) {
    int f,l;
    if (i < 10) {
      f i;
    }
    else if (i >= 10 && i < 100) {
      f = (int)i / 10;
    }
    else if (i >= 100 && i < 1000) {
      f = (int)i / 100;
    }
    else if (i >= 1000 && i < 10000) {
      f = (int)i / 1000;
    }
    else if (i >= 10000 && i < 100000) {
      f = (int)i / 10000;
    }
    else /* i >= 100000 */ {
      f = (int)i / 100000;
    }
    l = i % 10;
    fl[f][l]++;
  }
  int s = 0;
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      s += fl[i][j] * fl[j][i];
    }
  }
  cout << s << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: expected ',' or ';' before 'for'
   11 |   for (int i = 1; i <= N; ++i) {
      |   ^~~
a.cc:11:19: error: 'i' was not declared in this scope
   11 |   for (int i = 1; i <= N; ++i) {
      |                   ^
Language: C++

#include <iostream>

int digit(int n) {
  int d = 0;
  for (; n > 0; n /= 10, ++d) {}
  return d;
}

int main() {
  int n;
  std::cin >> n;
  int count = 0;
  int dig = digit(a);
  for (int a = 1; a <= n; ++a) {
    int lower = a % 10;
    if (!lower) continue;
    int upper = n;
    for (; upper >= 10; upper /= 10) {}
    int d = dig - 2;
    for (; d >= 0; --d) {
      count += std::pow(10, d);
    }
    count += (upper == lower);
  }
  std::cout << count << std::endl;
  return 0; 
}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: 'a' was not declared in this scope
   13 |   int dig = digit(a);
      |                   ^
a.cc:21:21: error: 'pow' is not a member of 'std'
   21 |       count += std::pow(10, d);
      |                     ^~~
a.cc: At global scope:
a.cc:28:3: error: expected unqualified-id before 'return'
   28 |   return 0;
      |   ^~~~~~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

#include <iostream>

using namespace std;

int main() {
  /*
  
  1. N以下の全ての組み合わせを二重forループで処理
  2. 各組合せをstring型に変換
  3. 最初の文字と最後の文字を比較

  */
  
  int N = 0;
  cin >> N;
  int count = 0;
  
  for (int A = 0; i <= N; i++) {
    for (int B = 0; m <= N; m++) {
      string AStr = A.toString();
      string BStr = B.toString();
      
      bool AfirstBlast = AStr[0] == Bstr[B.length()-1];
      bool AlastBfirst = BStr[0] == Astr[B.length()-1];
      
      if (AfirstBlast && AlastBfirst) {
        count++;
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: 'i' was not declared in this scope
   18 |   for (int A = 0; i <= N; i++) {
      |                   ^
a.cc:19:21: error: 'm' was not declared in this scope
   19 |     for (int B = 0; m <= N; m++) {
      |                     ^
a.cc:20:23: error: request for member 'toString' in 'A', which is of non-class type 'int'
   20 |       string AStr = A.toString();
      |                       ^~~~~~~~
a.cc:21:23: error: request for member 'toString' in 'B', which is of non-class type 'int'
   21 |       string BStr = B.toString();
      |                       ^~~~~~~~
a.cc:23:37: error: 'Bstr' was not declared in this scope; did you mean 'BStr'?
   23 |       bool AfirstBlast = AStr[0] == Bstr[B.length()-1];
      |                                     ^~~~
      |                                     BStr
a.cc:23:44: error: request for member 'length' in 'B', which is of non-class type 'int'
   23 |       bool AfirstBlast = AStr[0] == Bstr[B.length()-1];
      |                                            ^~~~~~
a.cc:24:37: error: 'Astr' was not declared in this scope; did you mean 'AStr'?
   24 |       bool AlastBfirst = BStr[0] == Astr[B.length()-1];
      |                                     ^~~~
      |                                     AStr
a.cc:24:44: error: request for member 'length' in 'B', which is of non-class type 'int'
   24 |       bool AlastBfirst = BStr[0] == Astr[B.length()-1];
      |                                            ^~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef pair<int,int> P;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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;}
const int MOD = 1000000007;
const int INF = 2147483647;
const ll LLINF = 1LL<<60;

P f(int x){
    int a=x%10;
    int b=0;
    while(x){
        b=x;
        x/=10;
    }
    return P(a,b);
}

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

int n;
cin >> n;
map<P,int> m;
for(int i=1;i<=n;++i){
    m[f(i)]++;
}
ll ans=0;
for(int i=1;i<=n++i){
    P p=f(i);
    P q(p.second,p.first);
    ans+=m[q];
}
fin(ans);

//////////////////////////////////////////////////////
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:19: error: expected ';' before 'i'
   66 | for(int i=1;i<=n++i){
      |                   ^
      |                   ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

P f(int x){
  int a=x%10;
  while(x){
    b=x;
    x/=10;
  }
  return P(a,b);
}
int main(){
  int n;
  cin>>n;
  map<P,int> freq;
  for(int i=1;i<=n;i++){
    P p=f(i);
    freq[p]++;
  }
  ll ans=0;
  for(int i=1;i<=n;i++){
    P p=f(i);
    P q(p.second,p.first);
    ans+=freq[q];
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'P f(int)':
a.cc:9:5: error: 'b' was not declared in this scope
    9 |     b=x;
      |     ^
a.cc:12:14: error: 'b' was not declared in this scope
   12 |   return P(a,b);
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

P f(int x){
  int a=x%10;
  while(x){
    b=x;
    x/=10;
  }
  return P(a,b);
}
int main(){
  int n;
  cin>>n;
  map<P,int> freq;
  for(int i=1;i<=n;i++){
    P p=f(i);
    freq[p]++;
  }
  ll ans=0;
  for(int i=1;i<=n;i++){
    P p=f(i);
    P q=(p.second,p.first);
    ans+=freq[q];
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'P f(int)':
a.cc:9:5: error: 'b' was not declared in this scope
    9 |     b=x;
      |     ^
a.cc:12:14: error: 'b' was not declared in this scope
   12 |   return P(a,b);
      |              ^
a.cc: In function 'int main()':
a.cc:25:21: error: conversion from 'int' to non-scalar type 'P' {aka 'std::pair<int, int>'} requested
   25 |     P q=(p.second,p.first);
      |                   ~~^~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, s, n) for (int i = (int)(s); i < (int)(n); i++)



int main(){
    int r;
    cin >> r;
    int cnt[10][10];
    memset(cnt, 0, sizeof(cnt));
    repn(i,1,r+1){
        string target = to_string(i);
        cnt[target[0] - '0'][target.back() - '0']++;
    }

    ll ans = 0;
    repn(i,1,10) repn(j,1,10) {
        ans += cnt[i][j] * cnt[j][i];
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'memset' was not declared in this scope
   21 |     memset(cnt, 0, sizeof(cnt));
      |     ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <queue>
  +++ |+#include <cstring>
    9 |
Language: C++

d = [0] * 100
for i in range(int(input()) + 1):
	s = str(i)
	d[int(s[0]) * 10 + int(s[-1])] += 1
r = range(1, 10)
print(sum(d[i * 10 + j] * d[j * 10 + i] for i in r for j in r))


Compiler output:
a.cc:1:1: error: 'd' does not name a type
    1 | d = [0] * 100
      | ^
Language: C++

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

int f[10][10];
 
int main() {
  int n; cin >> n;
  for (int x = 1; x <= n; x++) {
    int l = x % 10;
    for (y = x; y >= 10; y /= 10);
    int r = y;
    f[l][r]++;
  }
  ll ans = 0;
  for (int l = 0; l < 10; l++) {
    for (int r = 0; r < 10; r++) {
      ans += f[l][r] * 1ll * f[r][l];
    }
  }
  cout << ans << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: 'y' was not declared in this scope
   11 |     for (y = x; y >= 10; y /= 10);
      |          ^
a.cc:12:13: error: 'y' was not declared in this scope
   12 |     int r = y;
      |             ^
Language: C++

#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
typedef priority_queue<int> p_queue;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define fir first
#define sec second
map<pii,bool>mp;
map<int,bool>mp2;
ll res;
int n;
int get_top(int x){
	while(x>=10)x/=10;
	return x;
}
int get_last(int x){
	return (x%10);
}
int pow(int x){
	int num=1;
	while(x--){
		num*=10;
	}
	return num;
}
bool check(int x){
	if(x>n)return 0;
	mp1[x]=1;return 1;
}
void make(int x){
	pii num;
	num.fir=get_top(x);
	num.sec=get_last(x);
//	cout<<x<<":  "<<num.fir<<','<<num.sec<<'\n';
	if(num.sec==0)return;
	if(mp1[x])return;
	mp1[x]=1;
	if(x<10)res+=!mp[make_pair(x,x)],mp[make_pair(x,x)]=1;
	res+=int(mp[make_pair(min(x,num.sec*10+num.fir),max(x,num.sec*10+num.fir))]==0&&num.sec*10+num.fir<=n),mp[make_pair(min(x,num.sec*10+num.fir),max(x,num.sec*10+num.fir))]=(num.sec*10+num.fir<=n);
	res+=int(mp[make_pair(max(x,num.sec*10+num.fir),min(x,num.sec*10+num.fir))]==0&&num.sec*10+num.fir<=n),mp[make_pair(max(x,num.sec*10+num.fir),min(x,num.sec*10+num.fir))]=(num.sec*10+num.fir<=n);
	for(int i=1;i<10;i++){
		for(int j=0;j<pow(i);j++){
			int y=num.sec*pow(i+1)+j*10+num.fir;
			if(!check(y))goto found;
			else{
				res+=!mp[make_pair(min(x,y),max(x,y))],mp[make_pair(min(x,y),max(x,y))]=1;
				res+=!mp[make_pair(max(x,y),min(x,y))],mp[make_pair(max(x,y),min(x,y))]=1;
			}
		}
	}
	found:;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++){
		make(i); 
	} 
	cout<<res<<'\n';
//	for(int i=1;i<=n;i++)for(int j=i;j<n;j++)if(mp[make_pair(i,j)])cout<<'('<<i<<','<<j<<')'<<"   ";
//	cout<<mp[make_pair(1,11)];
	return 0;
}


Compiler output:
a.cc: In function 'bool check(int)':
a.cc:30:9: error: 'mp1' was not declared in this scope; did you mean 'mp2'?
   30 |         mp1[x]=1;return 1;
      |         ^~~
      |         mp2
a.cc: In function 'void make(int)':
a.cc:38:12: error: 'mp1' was not declared in this scope; did you mean 'mp2'?
   38 |         if(mp1[x])return;
      |            ^~~
      |            mp2
a.cc:39:9: error: 'mp1' was not declared in this scope; did you mean 'mp2'?
   39 |         mp1[x]=1;
      |         ^~~
      |         mp2
Language: C++

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

int a[10][10];

int main(void)
{
    int n, i, ans = 0;

    scanf("%d" ,&n);

    for (i = 1; i <= n; i++)
    {
		int first = i / (int)pow(log10((double)i, 10.0)), last = i % 10;

		a[first][last]++;
    }

    for (i = 1; i <= n; i++)
	{
		int first = front_num(i), last = i % 10;

		ans += a[last][first];
	}

	printf("%d" ,ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:47: error: no matching function for call to 'log10(double, double)'
   14 |                 int first = i / (int)pow(log10((double)i, 10.0)), last = i % 10;
      |                                          ~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/math.h:36,
                 from a.cc:2:
/usr/include/c++/14/cmath:357:5: note: candidate: 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::log10(_Tp)'
  357 |     log10(_Tp __x)
      |     ^~~~~
/usr/include/c++/14/cmath:357:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:28,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:125:1: note: candidate: 'double log10(double)'
  125 | __MATHCALL_VEC (log10,, (_Mdouble_ __x));
      | ^~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:125:1: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:349:3: note: candidate: 'constexpr long double std::log10(long double)'
  349 |   log10(long double __x)
      |   ^~~~~
/usr/include/c++/14/cmath:349:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:345:3: note: candidate: 'constexpr float std::log10(float)'
  345 |   log10(float __x)
      |   ^~~~~
/usr/include/c++/14/cmath:345:3: note:   candidate expects 1 argument, 2 provided
a.cc:16:26: error: 'last' was not declared in this scope
   16 |                 a[first][last]++;
      |                          ^~~~
a.cc:21:29: error: 'front_num' was not declared in this scope
   21 |                 int first = front_num(i), last = i % 10;
      |                             ^~~~~~~~~
a.cc:23:26: error: 'last' was not declared in this scope
   23 |                 ans += a[last][first];
      |                          ^~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define FOR(i,m,n) for(ll i=(m); i<(n); ++i)

#define int ll
void solve()
  int n; cin>>n;
  int dp[10][10]={};
  int ans=0;
  FOR(i,1,n+1) {
    string s = to_string(i);
    dp[s[0]-'0'][s.back()-'0']++;
  }

  FOR(i,1,10)
    FOR(j,1,10)
      ans += dp[i][j]*dp[j][i];
  cout << ans << endl;
}

#undef int
int main() {
  solve();
  return 0;
}

Compiler output:
a.cc:6:13: error: expected initializer before 'll'
    6 | #define int ll
      |             ^~
a.cc:8:3: note: in expansion of macro 'int'
    8 |   int n; cin>>n;
      |   ^~~
a.cc:8:10: error: 'cin' does not name a type
    8 |   int n; cin>>n;
      |          ^~~
a.cc:4:20: error: expected unqualified-id before 'for'
    4 | #define FOR(i,m,n) for(ll i=(m); i<(n); ++i)
      |                    ^~~
a.cc:11:3: note: in expansion of macro 'FOR'
   11 |   FOR(i,1,n+1) {
      |   ^~~
a.cc:11:7: error: 'i' does not name a type
   11 |   FOR(i,1,n+1) {
      |       ^
a.cc:4:34: note: in definition of macro 'FOR'
    4 | #define FOR(i,m,n) for(ll i=(m); i<(n); ++i)
      |                                  ^
a.cc:4:41: error: expected unqualified-id before '++' token
    4 | #define FOR(i,m,n) for(ll i=(m); i<(n); ++i)
      |                                         ^~
a.cc:11:3: note: in expansion of macro 'FOR'
   11 |   FOR(i,1,n+1) {
      |   ^~~
a.cc:4:20: error: expected unqualified-id before 'for'
    4 | #define FOR(i,m,n) for(ll i=(m); i<(n); ++i)
      |                    ^~~
a.cc:16:3: note: in expansion of macro 'FOR'
   16 |   FOR(i,1,10)
      |   ^~~
a.cc:16:7: error: 'i' does not name a type
   16 |   FOR(i,1,10)
      |       ^
a.cc:4:34: note: in definition of macro 'FOR'
    4 | #define FOR(i,m,n) for(ll i=(m); i<(n); ++i)
      |                                  ^
a.cc:4:41: error: expected unqualified-id before '++' token
    4 | #define FOR(i,m,n) for(ll i=(m); i<(n); ++i)
      |                                         ^~
a.cc:16:3: note: in expansion of macro 'FOR'
   16 |   FOR(i,1,10)
      |   ^~~
a.cc:17:9: error: 'j' does not name a type
   17 |     FOR(j,1,10)
      |         ^
a.cc:4:34: note: in definition of macro 'FOR'
    4 | #define FOR(i,m,n) for(ll i=(m); i<(n); ++i)
      |                                  ^
a.cc:4:41: error: expected unqualified-id before '++' token
    4 | #define FOR(i,m,n) for(ll i=(m); i<(n); ++i)
      |                                         ^~
a.cc:17:5: note: in expansion of macro 'FOR'
   17 |     FOR(j,1,10)
      |     ^~~
a.cc:19:3: error: 'cout' does not name a type
   19 |   cout << ans << endl;
      |   ^~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
a.cc: In function 'int main()':
a.cc:24:3: error: 'solve' was not declared in this scope
   24 |   solve();
      |   ^~~~~
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
int main(){
    int n;
    cin>>n;
    int arr[10][10]={0};
    for (int i = 1; i <= n; i++)
    {
        string s=to_string(i);
            arr[s[0] - '0'][s.back() - '0']++;
    }
    long long int ans = 0;
    for(int i=0;i< 10;i++){
        for (int j = 0; j < 10; j++)
        {
            ans += arr[i][j] * arr[j][i];
        }        
    }
    cout<<ans<<endl;return 0;6
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:31: error: expected ';' before '}' token
   20 |     cout<<ans<<endl;return 0;6
      |                               ^
      |                               ;
   21 | }
      | ~
Language: C++

import numpy as np
def cmb(n, r):
    if n<r:
      return 0
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n = int(input())
field = np.array([[0 for _ in range(9)] for _ in range(9)])

for i in range(1, n+1):
    stri = str(i)
    mae = int(stri[0])
    ushiro = int(stri[-1])
    if mae != 0 and ushiro != 0:
        field[mae-1, ushiro-1] += 1

total = 0
for i in range(9):
    val = field[i, i]
    #print(val)
    #print(cmb(val, 2))
    total += val
    total += 2*cmb(val, 2)

for i in range(9):
    for j in range(i, 9):
        if i==j:
            continue
        else:
            total += 2*field[i,j]*field[j,i]
#print(field)
print(total)

Compiler output:
a.cc:40:6: error: invalid preprocessing directive #print
   40 |     #print(val)
      |      ^~~~~
a.cc:41:6: error: invalid preprocessing directive #print
   41 |     #print(cmb(val, 2))
      |      ^~~~~
a.cc:51:2: error: invalid preprocessing directive #print
   51 | #print(field)
      |  ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'