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

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7; 

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF_INT (1<<30)
#define INF_LL (1ll<<62)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll cnt[10][10],N,ans;
string tmp;

int main(){
    cin>>N;
    repi(i,1,N+1){
        tmp = to_string(i);
        cnt[tmp[0]-'0'][tmp[tmp.size()-1]-'0']++;
    }
    rep(i,10){
        rep(j,10){
            ans+=cnt[i][j]*c[j][i];
        }
    }
    out(ans);
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:28: error: 'c' was not declared in this scope
   40 |             ans+=cnt[i][j]*c[j][i];
      |                            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int sum = 0;
	for (int i = 1; i <= 9; i++)
		for (int j = 1; j <= 9; j++)
			int mid1 = 0;
	int mid2 = 0;
	for (int k = 1; k <= n; k++)
	{
		int h = k, t = k % 10;
		if (k >= 10)
		{
			k /= 10;
		}
		if (h == i && t == j)
			mid1++;
		if (h == j && t == i)
			mid2++;
	}
	sum += mid1 * mid2;
	cout << sum << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:26: error: 'i' was not declared in this scope
   19 |                 if (h == i && t == j)
      |                          ^
a.cc:19:36: error: 'j' was not declared in this scope
   19 |                 if (h == i && t == j)
      |                                    ^
a.cc:20:25: error: 'mid1' was not declared in this scope; did you mean 'mid2'?
   20 |                         mid1++;
      |                         ^~~~
      |                         mid2
a.cc:21:26: error: 'j' was not declared in this scope
   21 |                 if (h == j && t == i)
      |                          ^
a.cc:21:36: error: 'i' was not declared in this scope
   21 |                 if (h == j && t == i)
      |                                    ^
a.cc:24:16: error: 'mid1' was not declared in this scope; did you mean 'mid2'?
   24 |         sum += mid1 * mid2;
      |                ^~~~
      |                mid2
Language: C++

#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
#define ub upper_bound
#define lb lower_bound
#define pii pair<int,int>
using namespace std;
signed main()
{
    fast;
    int n;
    cin>>n;1
    int dp[10][10]={};
    for(int i=1;i<=n;i++){
		string s = to_string(i);
		int nn = s.size();
		int ss = s[0]-'0';
		int en = s[nn-1]-'0';
		dp[ss][en]+=1;
	}
	int ans = 0;
	for(int i=1;i<=9;i++)
		for(int j=1;j<=9;j++)
			ans+=(dp[i][j]*dp[j][i]);
	cout<<ans;
}   


Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: expected ';' before 'long'
   15 |     cin>>n;1
      |             ^
      |             ;
a.cc:22:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   22 |                 dp[ss][en]+=1;
      |                 ^~
      |                 dup
a.cc:27:31: error: 'dp' was not declared in this scope; did you mean 'dup'?
   27 |                         ans+=(dp[i][j]*dp[j][i]);
      |                               ^~
      |                               dup
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
ll p[200005];
typedef pair<int, int> p;
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;
	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;
	return 0;
}

Compiler output:
a.cc:8:24: error: 'typedef struct std::pair<int, int> p' redeclared as different kind of entity
    8 | typedef pair<int, int> p;
      |                        ^
a.cc:7:4: note: previous declaration 'll p [200005]'
    7 | ll p[200005];
      |    ^
a.cc:9:1: error: 'p' does not name a type
    9 | p f(int x) {
      | ^
a.cc: In function 'int main()':
a.cc:21:19: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
   21 |         map<p, int>freq;
      |                   ^
a.cc:21:19: note:   expected a type, got 'p'
a.cc:21:19: error: template argument 3 is invalid
a.cc:21:19: error: template argument 4 is invalid
a.cc:23:18: error: expected ';' before 'p'
   23 |                 p p = f(i);
      |                  ^~
      |                  ;
a.cc:28:18: error: expected ';' before 'P'
   28 |                 p P = f(i);
      |                  ^~
      |                  ;
a.cc:29:18: error: expected ';' before 'q'
   29 |                 p q(P.second, P.first);
      |                  ^~
      |                  ;
a.cc:30:29: error: 'q' was not declared in this scope
   30 |                 ans += freq[q];
      |                             ^
Language: C++

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

vector<vector<int>> V( 9,vector<int>(9,0) );
int n;

int main(){
    cin>>n;
    for(int i = 0 ; i <= n; i++){
        int top = i;
        while(top >= 10) top /= 10;
        int btm = i - ( i/10 ) *10;
        if (btm == 0 ) continue;
        top--;btm--;
        V.at(top).at(btm)++;
    }

    int ans = 0;
    for(int i =0; i < 9; i++){
        for(int j = 0; j<9;j++){
            ans += V.at(i).at(j) * V.at(j)(i);
        }
    }
    cout<< ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:43: error: no match for call to '(__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>}) (int&)'
   23 |             ans += V.at(i).at(j) * V.at(j)(i);
      |                                    ~~~~~~~^~~
Language: C++

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

vector<vector<int>> V( 9,vector<int>(9,0) );
int n;

int main(){
    cin>>n;
    for(int i = 0 ; i <= N; i++){
        int top = i;
        while(top >= 10) top /= 10;
        int btm = i - ( i/10 ) *10;
        if (btm == 0 ) continue;
        top--;btm--;
        V.at(top).at(btm)++;
    }

    int ans = 0;
    for(int i =0; i < 9; i++){
        for(int j = 0; j<9;j++){
            ans += V.at(i).at(j) * V.at(j)(i);
        }
    }
    cout<< ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: error: 'N' was not declared in this scope
   11 |     for(int i = 0 ; i <= N; i++){
      |                          ^
a.cc:23:43: error: no match for call to '(__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>}) (int&)'
   23 |             ans += V.at(i).at(j) * V.at(j)(i);
      |                                    ~~~~~~~^~~
Language: C++

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

int n;
int main(){
    cin>>n;
    int cnt;
    for(int i = 0; i <= 9;  i++){
        for(int j = 0; j < 9 ; j++){
            for(int k = 1; k <= n; k++){
                int btm = k % 10;
                int top = k % (log10(k)+1);
                if( top == i && btm == j) c[i][j] = c[j][i]= 1;;
            }
        }
    }
    for(int i = 0; i <= 9; i++){
        for(int j =0 ;j<=9;j++){
            if(c[i][j]) cnt++;
        }
    }
    cout << cnt <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:29: error: invalid operands of types 'int' and '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} to binary 'operator%'
   14 |                 int top = k % (log10(k)+1);
      |                           ~ ^ ~~~~~~~~~~~~
      |                           |            |
      |                           int          __gnu_cxx::__enable_if<true, double>::__type {aka double}
a.cc:15:43: error: 'c' was not declared in this scope
   15 |                 if( top == i && btm == j) c[i][j] = c[j][i]= 1;;
      |                                           ^
a.cc:21:16: error: 'c' was not declared in this scope
   21 |             if(c[i][j]) cnt++;
      |                ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll =long long;
using P = pair<int,int> ;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cout << #x << " = " << (x) << endl;
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1LL << 60;

//与えられた数字の先頭の数b と、末尾の数aを取得して、Ｐ型の(a,b)を返す
P f(int x){
	int a  =x % 10 ;//末尾の数
	int b = 0 ;
	while(x){
		b = x ;
		x /= 10;
	}
	return P(a,b);
}
//aで始まりbで終わる数に対してi(bで始まりaで終わる数は条件を満たすものだよ)<-n以下であることはnまでのループであることから分かる。

//Write From this Line

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);
		//今、i がaで始まってbで終わる数だとすると、bで始まってaで終わる数の個数をansに＋したい。
		//f(i)は、(b,a)に対応するものとして、iは可能。っていうことを示しているので、逆にここでは、(a,b)に対応して何個可能なものがあるかを見たい。
		//だから、まあとりあえず入れ替えないといけない
		P q = (p.second,p.first);
		ans += freq[q];
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:35: error: conversion from 'int' to non-scalar type 'P' {aka 'std::pair<int, int>'} requested
   48 |                 P q = (p.second,p.first);
      |                                 ~~^~~~~
Language: Java

import javafx.util.Pair;
import java.util.*;
public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long sum = 0;
        Map<Pair<Integer,Integer>,Integer> map = new HashMap<>();
        for(int i=1;i<=N;i++){
            if(i%10!=0) {
                Pair<Integer, Integer> P = F(i);
                if (map.get(P) == null) map.put(P, 1);
                else map.replace(P, map.get(P) + 1);
            }
        }
        for(int i=1;i<=N;i++){
            if(i%10!=0) {
                Pair<Integer, Integer> P = F(i);
                Pair<Integer, Integer> Q = new Pair<>(P.getValue(), P.getKey());
                if (map.get(Q) != null) sum += map.get(Q);
            }
        }
        System.out.println(sum);
    }
    public static Pair<Integer,Integer> F(int i) {
        int a = i % 10;
        int b = 0;
        while (i != 0) {
            b = i;
            i /= 10;
        }
        Pair<Integer, Integer> P = new Pair<>(a, b);
        return P;
    }
}

Compiler output:
Main.java:1: error: package javafx.util does not exist
import javafx.util.Pair;
                  ^
Main.java:25: error: cannot find symbol
    public static Pair<Integer,Integer> F(int i) {
                  ^
  symbol:   class Pair
  location: class Main
Main.java:8: error: cannot find symbol
        Map<Pair<Integer,Integer>,Integer> map = new HashMap<>();
            ^
  symbol:   class Pair
  location: class Main
Main.java:11: error: cannot find symbol
                Pair<Integer, Integer> P = F(i);
                ^
  symbol:   class Pair
  location: class Main
Main.java:18: error: cannot find symbol
                Pair<Integer, Integer> P = F(i);
                ^
  symbol:   class Pair
  location: class Main
Main.java:19: error: cannot find symbol
                Pair<Integer, Integer> Q = new Pair<>(P.getValue(), P.getKey());
                ^
  symbol:   class Pair
  location: class Main
Main.java:19: error: cannot find symbol
                Pair<Integer, Integer> Q = new Pair<>(P.getValue(), P.getKey());
                                               ^
  symbol:   class Pair
  location: class Main
Main.java:32: error: cannot find symbol
        Pair<Integer, Integer> P = new Pair<>(a, b);
        ^
  symbol:   class Pair
  location: class Main
Main.java:32: error: cannot find symbol
        Pair<Integer, Integer> P = new Pair<>(a, b);
                                       ^
  symbol:   class Pair
  location: class Main
9 errors
Language: Java

import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[][] a = new int[10][10];

   int ans = 0;
   int tmpa=0;
   int tmpb=0;
   for(int i=1;i<=N;i++)
   {
     tmpa=i;
     tmpb=i;
     tmpa=tmpa%10;
     while(tmpb>=10)
     {
       tmpb=/10;
     }
     a[tmpa][tmpb]++;
   }
   
   for(int i =1; i<=9;i++)
   {
     for(int k =1;k<=9;k++) ans+= a[i][k]*a[k][i];
   }
   System.out.println(ans);
 }
}

Compiler output:
Main.java:18: error: illegal start of expression
       tmpb=/10;
            ^
1 error
Language: C++

#include <bits/stc++.h>
using namespace std;
int main() {
  	int cnt[10][10];
  	memset(cnt,0,sizeof cnt);
  	int N;
  	cin >> N;
  	long long cntr = 0;
  	for (int i = 1; i <= N; i++) {
    	string s = to_string(i);
      	cnt[s[0]-'0'][s[s.length()-1]-'0']++;
    }
  	for (int i = 1; i <= N; i++) {
    	string s = to_string(i);
      	cntr += cnt[s[0]-'0'][s[s.length()-1]-'0'];
    }
  	printf("%lld\n",cntr);
}

Compiler output:
a.cc:1:10: fatal error: bits/stc++.h: No such file or directory
    1 | #include <bits/stc++.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

P headsTail(int x) {
  int tail = x % 10;
  int heads = tail;
  while ((x / 10) != 0) {
    x /= 10;
  }
  heads = x;
  P ans(heads, tail);
  return ans;
}

int main() {
  int N;
  cin >> N;
  ll sum = 0;
  map<P, int> freq;
  for (int i = 1; i <= N; i++) {
    P p = headsTail(i);
    // 整数iにおいてのpair = {heads, tail}
    freq[p]++;
    // 例えば(1, 9)みたいなペアがあったら，その集計を1増やす
    // 存在しないキー値にアクセスすると勝手にゼロ値を代入してくれる
  }

  for (int i = 1; i<= N; i++){
    P p = headsTail(i);
    P q(p.second, p.first);
    sum += freq[q];
  }
  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc:4:19: error: declaration does not declare anything [-fpermissive]
    4 | typedef long long int;
      |                   ^~~
a.cc: In function 'int main()':
a.cc:21:3: error: 'll' was not declared in this scope
   21 |   ll sum = 0;
      |   ^~
a.cc:34:5: error: 'sum' was not declared in this scope
   34 |     sum += freq[q];
      |     ^~~
a.cc:36:11: error: 'sum' was not declared in this scope
   36 |   cout << sum << endl;
      |           ^~~
Language: C++

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

P headsTail(int x) {
  int tail = x % 10;
  int heads;
  while (!(x / 10)) {
    x /= 10;
  }
  heads = x;
  P ans = make_pair(heads, tail);
  return ans;
}

int main() {
  int N;
  cin >> N;
  li sum = 0;
  P hta, htb;
  map<P, int> freq;
  for (int i = 1; i <= N; i++) {
    P p = headsTail(i);
    // 整数iにおいてのpair = {heads, tail}
    map[p] += 1;
    // 例えば(1, 9)みたいなペアがあったら，その集計を1増やす
    // 存在しないキー値にアクセスすると勝手にゼロ値を代入してくれる
  }

  rep(i, N) {
    P p = headsTail(i);
    P q = make_pair(p.second, p.first);
    sum += freq[q];
  }
  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: conflicting declaration 'auto p'
   27 |     map[p] += 1;
      |         ^
a.cc:25:7: note: previous declaration as 'P p'
   25 |     P p = headsTail(i);
      |       ^
a.cc:27:12: error: expected initializer before '+=' token
   27 |     map[p] += 1;
      |            ^~
Language: Java

import java.io.*;
public class TestClass {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader((new InputStreamReader(System.in)));
        int N = Integer.parseInt(reader.readLine());
        long res = 0;
        int[][] a = new int[10][10];
        for(int i=1;i<N;i++){
            String s = Integer.toString(i);
            a[Character.getNumericValue(s.charAt(0))][i%10]+=1;
        }

        for(int u=0;u<10;u++){
            res+=a[u][u];
            for(int i=u+1;i<10;i++){
                res+=2*a[u][i]*a[i][u];
            }
        }
        System.out.println(res);
    }

}

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

#include<iostream>
using namespace std;
long N,c[10][10],a;
int main(){
  cin>>N;
  for(int i=0;i<=N;i++)c[to_string(i)[0]-'0'][i%10]++;
  for(int i=0;i<10;i++)for(int j=0;j<10;j++)ans+=c[i][j]*c[j][i];
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:45: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |   for(int i=0;i<10;i++)for(int j=0;j<10;j++)ans+=c[i][j]*c[j][i];
      |                                             ^~~
      |                                             abs
a.cc:8:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
    8 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

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



void pre_calc(int n, int table[10][10]){
    for(size_t tmp=n;tmp>0;tmp--){
        table[first(tmp)][tmp%10]+=1;
    }
}



int main(){
    // あとで消す
    //std::ifstream in("din1.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N;
    cin >> N;

    int table[10][10];

    for(size_t i=0;i<=9;i++){
        for(size_t j=0;j<=9;j++){
            table[i][j] = 0;
        }
    }

    /*
    for(size_t i=1;i<=9;i++){
        for(size_t j=1;j<=9;j++){
            printf("%d, ",table[i][j]);
        }
        printf("\n");
    }
    */

    pre_calc(N, table);
    //cout << endl;

    /*
    for(size_t i=1;i<=9;i++){
        for(size_t j=1;j<=9;j++){
            printf("%d, ",table[i][j]);
        }
        printf("\n");
    }
    */

    int count = 0;
    for(size_t i=1;i<=9;i++){
        for(size_t j=1;j<=9;j++){
            count += table[i][j]*table[j][i];
        }
    }
    cout << count <<endl;

    return 0;
}


Compiler output:
a.cc: In function 'void pre_calc(int, int (*)[10])':
a.cc:11:15: error: 'first' was not declared in this scope
   11 |         table[first(tmp)][tmp%10]+=1;
      |               ^~~~~
Language: C++

int main() {
    cin >> N;
    vector<vector<int>> C(10, vector<int>(10));
    for (int i = 1; i <= N; i++) {
        int left = i, right = i % 10;
        while (left > 9) {
            left /= 10;
        }
        C[left][right]++;
    }
    long long ans = 0;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            ans += 1ll * C[i][j] * C[j][i];
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'cin' was not declared in this scope
    2 |     cin >> N;
      |     ^~~
a.cc:2:12: error: 'N' was not declared in this scope
    2 |     cin >> N;
      |            ^
a.cc:3:5: error: 'vector' was not declared in this scope
    3 |     vector<vector<int>> C(10, vector<int>(10));
      |     ^~~~~~
a.cc:3:19: error: expected primary-expression before 'int'
    3 |     vector<vector<int>> C(10, vector<int>(10));
      |                   ^~~
a.cc:9:9: error: 'C' was not declared in this scope
    9 |         C[left][right]++;
      |         ^
a.cc:14:26: error: 'C' was not declared in this scope
   14 |             ans += 1ll * C[i][j] * C[j][i];
      |                          ^
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout << ans << endl;
      |     ^~~~
a.cc:17:20: error: 'endl' was not declared in this scope
   17 |     cout << ans << endl;
      |                    ^~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;

int main() {
  int64_t n;
  cin >> n;
  vector<int64_t> v(n+1);
  if(n < 10) s = n;
  else{
    v[10] = 9;
    for(int i = 11; i <= n; ++i){
      int a = i, b = i % 10, c = i, d = 1;
      while(a / 10 != 0) a /= 10;
      while(c / 10 != 0){
        c /= 10;
        ++d;
      }
      if(a == b){
        if(d == 2) v[i] = v[i-1] + 3;
        else{
          int j = i - a * pow(10, d-1);
          j /= 10;
          v[i] = v[i-1] + 2 * j + 6;
        }
      }
      else if(a < b){
        if(d == 2) v[i] = v[i-1];
        else v[i] = v[i-1] + 2 * ((d-2)*1+max(0,d-3)*10+max(0,d-4)*100+max(0,d-5)*1000);
      }
      else{
        if(d == 2) v[i] = v[i-1] + 2;
        else v[i] = v[i-1] + 2 * ((d-2)*11+max(0,d-3)*100+max(0,d-4)*1000+max(0,d-5)*10000);
      }
    }
    s = v[n];
  }
  cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: 's' was not declared in this scope
   10 |   if(n < 10) s = n;
      |              ^
a.cc:37:5: error: 's' was not declared in this scope
   37 |     s = v[n];
      |     ^
a.cc:39:11: error: 's' was not declared in this scope
   39 |   cout << s << endl;
      |           ^
Language: C++

#include <iostream>
#include <unordered_map>
#include <utility>

using namespace std;
int main() {
    int n;
    cin >> n;
    if (n < 9) {
        cout << n << endl;
        return 0;
    }
    unordered_map<string, int> m;
    

    for (int i = 1; i <= n; ++i) {
        string s = to_string(i);
        if (s.back() == '0') continue;
        string t{s.front()}, u{s.back()};
        string x = t + u;
        //cout << x << endl;
        m[x] += 1;
    }
    
    for (auto x : m) {
        string tmp = x.first;
        int a;
        reverse(tmp.begin(), tmp.end());
        if (tmp != x.first) {
            a = m[tmp];
        }
        //cout << x.first << ", " << x.second << ", " << m[tmp] << ", " << ans << endl;
    }
    long long ans = 0;
    for (auto x : m) {
        string tmp = x.first;
        reverse(tmp.begin(), tmp.end());
        if (tmp == x.first) {
            ans += x.second * (x.second - 1) + x.second;
        } else {
          ans += (m[tmp] * x.second);
        }
        //cout << x.first << ", " << x.second << ", " << m[tmp] << ", " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'reverse' was not declared in this scope
   28 |         reverse(tmp.begin(), tmp.end());
      |         ^~~~~~~
a.cc:37:9: error: 'reverse' was not declared in this scope
   37 |         reverse(tmp.begin(), tmp.end());
      |         ^~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;

int main() {
  int64_t n;
  cin >> n;
  vector<int64_t> v(n+1);
  if(n < 10) s = n;
  else{
    v[10] = 9;
    for(int i = 11; i <= n; ++i){
      int a = i, b = i % 10, c = i, d = 1;
      while(a / 10 != 0) a /= 10;
      while(c / 10 != 0){
        c /= 10;
        ++d;
      }
      if(a == b){
        if(d == 2) v[i] = v[i-1] + 3;
        else{
          int j = i - a * pow(10, d-1);
          j /= 10;
          v[i] = v[i-1] + 2 * j + 6;
      }
      else if(a < b){
        if(d == 2) v[i] = v[i-1];
        else v[i] = v[i-1] + 2 * ((d-2)*1+max(0,d-3)*10+max(0,d-4)*100+max(0,d-5)*1000);
      }
      else{
        if(d == 2) v[i] = v[i-1] + 2;
        else{
          v[i] = v[i-1] + 2 * ((d-2)*11+max(0,d-3)*100+max(0,d-4)*1000+max(0,d-5)*10000);
        }
      }
    }
    s = v[n];
  }
  cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: 's' was not declared in this scope
   10 |   if(n < 10) s = n;
      |              ^
a.cc:27:7: error: expected '}' before 'else'
   27 |       else if(a < b){
      |       ^~~~
a.cc:20:17: note: to match this '{'
   20 |       if(a == b){
      |                 ^
a.cc:38:5: error: 's' was not declared in this scope
   38 |     s = v[n];
      |     ^
a.cc:40:11: error: 's' was not declared in this scope
   40 |   cout << s << endl;
      |           ^
Language: C++

#include<map>
#include<iostream>
using namespace std;
#define df 0
#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
typedef long int li;

int main(){
  if(df) printf("*debug mode*\n");
  int n; cin >>n;
  map<pair<int,int>,int> mp;
  rep(i,n){
    int x=i+1;
    mp[p(x)]++;
  }
  li ans=0;
  repa(i,1,10){
    li temp=mp[pair<int,int>(i,i)];
    ans+=temp*temp;
  }
  repa(i,1,9){
    repa(j,i+1,10){
      li t1=mp[pair<int,int>(i,j)];
      li t2=mp[pair<int,int>(j,i)];
      ans+=t1*t2*2;
    }
  }
  cout << ans;
}

/// confirm df==0 ///


Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: 'p' was not declared in this scope
   15 |     mp[p(x)]++;
      |        ^
Language: C

#include<stdio.h>

 int ans = 0;

int jujo(int n){
  int ans = 1;
  for(int i = 0;i < n;i++){
    ans *= 10;
  }
  return ans;
}
    
  

int choice(int x,int s){
  int s;
  int keta = 1,sento = s,i,saigo,x;
  saigo = s%10;
  while(sento >= 10){
    sento /= 10;
    keta++;
  }
  if(saigo == sento){
  ans++;
  }
  i = 1;
  while(x < s){
    x = saigo*jujo(i) + sento;
    i++;
    ans++;
  }  

  /*次へ*/
  if(x > s){
    return choice(s + 1);
  }
  else if(x == s){
    return ans;
  }

  return -1;
}

int main(){
  int n;
  scanf("%d",&n);
  int keta = 1,sento = n,i;
  /*
  while(sento >= 10){
    sento /= 10;
    keta++;
  }
  printf("%d %d\n",sento,keta);
  */
  choice(n,1);
  printf("%d\n",ans);
  return 0;
}


Compiler output:
main.c: In function 'choice':
main.c:16:7: error: 's' redeclared as different kind of symbol
   16 |   int s;
      |       ^
main.c:15:22: note: previous definition of 's' with type 'int'
   15 | int choice(int x,int s){
      |                  ~~~~^
main.c:17:34: error: 'x' redeclared as different kind of symbol
   17 |   int keta = 1,sento = s,i,saigo,x;
      |                                  ^
main.c:15:16: note: previous definition of 'x' with type 'int'
   15 | int choice(int x,int s){
      |            ~~~~^
main.c:35:12: error: too few arguments to function 'choice'
   35 |     return choice(s + 1);
      |            ^~~~~~
main.c:15:5: note: declared here
   15 | int choice(int x,int s){
      |     ^~~~~~
Language: C++

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

int count(int a, int x, int y, int n) {
  int ret = 0;
  int keta = log10(a) + 1;
  int nketa = log10(n) + 1;
  // if (keta == 1) {
  if(nketa == 1){
    return 1;
  }
  if(nketa == 2){
    if(keta == 1 || x==y) {
    }
    if((10*y+x) > n) {
      ret =  0;
    }
    else {
      ret =  1;
    }
  }
  if(nketa == 3) {
    if(100*y+x > n){
      ret = 2;
    }
    else {
      ret =  2 + ((n - (100*y + x)) / 10);
    }
  }
  if(nketa == 4) {
    if(1000*y+x > n){
      ret 2 + 9;
    }
    else {
      ret 2 + 9 + ((n - (1000*y + x)) / 10);
    }
  }
  if(nketa == 5) {
    if(1-000*y+y > n){
      ret 2 + 9 + 99;
    }
    else {
      ret 2 + 99 + ((n - (10000*y + x)) / 10);
    }
  }
  if(x == y)
    return ret +1;
  else
    return ret;
}
//   if(keta >= 2) {
//     if(x == y){
//       if(nketa <= 2)
//       return 2;
//     }
//     int kouho = y*10 + x;
//     if(kouho <= n){
//       return 1;
//     }
//     else{
//       return 0;
//     }
//   }
//   return 0;
// }

int main() {
  int n;
  cin >> n;
  int keta = log10(n) + 1;
  int chigau = 36;
  int onaji = 9;
  int ans = 0;
  rep(i,n+1) {
    if(i%10 == 0) {
      cout << "i: " << i << " pass" << endl;
      cout << endl;
      continue;
    }
    else{
      int x = i / pow(10, log(1) +1);
      int y = i % 10;
      // cout << "i :" << i << endl;
      // cout << "x :" << x << endl;
      // cout << "y :" << y << endl;
      // cout << "count(i, x, y, n) :" << count(i, x, y, n) << endl;
      // cout << endl;
      ans += count(i, x, y, n);
    }
  }
  cout << ans<< endl;
  return 0;
}


Compiler output:
a.cc: In function 'int count(int, int, int, int)':
a.cc:34:10: error: expected ';' before numeric constant
   34 |       ret 2 + 9;
      |          ^~
      |          ;
a.cc:37:10: error: expected ';' before numeric constant
   37 |       ret 2 + 9 + ((n - (1000*y + x)) / 10);
      |          ^~
      |          ;
a.cc:42:10: error: expected ';' before numeric constant
   42 |       ret 2 + 9 + 99;
      |          ^~
      |          ;
a.cc:45:10: error: expected ';' before numeric constant
   45 |       ret 2 + 99 + ((n - (10000*y + x)) / 10);
      |          ^~
      |          ;
Language: C++

<?php
  
  $x = trim(fgets(STDIN));
  $xd = strlen($x);

  $c = 0;
  for($i=1; $i<$xd; $i++){
    $t = 9;
    for($j=1; $j<$i; $j++){
      $t += (10**$j)*9;
    }
    $c += $t;
  }

  for ($i = 1;$i <= min($x[0], $x[$xd-1])*$xd ;$i++){
      $number = 1;
      for ($j = $i; $j >= 1; $j--){
          $number *= $j;
      }      
  }


  echo $c + $number;
  
  
  
?>

Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <?php
      | ^
a.cc:4:3: error: '$xd' does not name a type
    4 |   $xd = strlen($x);
      |   ^~~
a.cc:6:3: error: '$c' does not name a type
    6 |   $c = 0;
      |   ^~
a.cc:7:3: error: expected unqualified-id before 'for'
    7 |   for($i=1; $i<$xd; $i++){
      |   ^~~
a.cc:7:13: error: '$i' does not name a type
    7 |   for($i=1; $i<$xd; $i++){
      |             ^~
a.cc:7:21: error: '$i' does not name a type
    7 |   for($i=1; $i<$xd; $i++){
      |                     ^~
a.cc:15:3: error: expected unqualified-id before 'for'
   15 |   for ($i = 1;$i <= min($x[0], $x[$xd-1])*$xd ;$i++){
      |   ^~~
a.cc:15:15: error: '$i' does not name a type
   15 |   for ($i = 1;$i <= min($x[0], $x[$xd-1])*$xd ;$i++){
      |               ^~
a.cc:15:48: error: '$i' does not name a type
   15 |   for ($i = 1;$i <= min($x[0], $x[$xd-1])*$xd ;$i++){
      |                                                ^~
a.cc:23:3: error: 'echo' does not name a type
   23 |   echo $c + $number;
      |   ^~~~
a.cc:27:1: error: expected unqualified-id before '?' token
   27 | ?>
      | ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
  int i,j,n,ans=0;
  
  scanf("%d",&n);
  
  if(10>n){
    ans=n;
  }
  else if(9<n&&n<100){
    ans=0;
    for(i=n;i>0;i--){
      if(i%10==i/10){
        ans++;
      }
    }
  else if(99<n&&n<1000){
    ans=0;
    for(i=n;i>0;i--){
      if(i%100==i/100){
        ans++;
      }
    }
    
  else if(999<n&&n<10000){
    ans=0;
    for(i=n;i>0;i--){
      if(i%1000==i/1000){
        ans++;
      }
    }
    
  else if(9999<n&&n<100000){
    ans=0;
    for(i=n;i>0;i--){
      if(i%10000==i/1000){
        ans++;
      }
    }
     
  else if(99999<n&&n<1000000){
    ans=0;
    for(i=n;i>0;i--){
      if(i%100000==i/10000){
        ans++;
      }
    }
    else if(999999<n&&n<10000000){
    ans=0;
    for(i=n;i>0;i--){
      if(i%1000000==i/100000){
        ans++;
      }
    }
      

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

Compiler output:
main.c: In function 'main':
main.c:19:3: error: expected '}' before 'else'
   19 |   else if(99<n&&n<1000){
      |   ^~~~
main.c:27:3: error: expected '}' before 'else'
   27 |   else if(999<n&&n<10000){
      |   ^~~~
main.c:35:3: error: expected '}' before 'else'
   35 |   else if(9999<n&&n<100000){
      |   ^~~~
main.c:43:3: error: expected '}' before 'else'
   43 |   else if(99999<n&&n<1000000){
      |   ^~~~
main.c:50:5: error: expected '}' before 'else'
   50 |     else if(999999<n&&n<10000000){
      |     ^~~~
Language: C++

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

//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int N;
int solve(int i, int N) { // iは11~99までの数
  int num = 0;
  int one = i%10;
  int ten = i/10;
  if (ten == 0) ten=i;
  int cnt = 0; 
  int j = 0, k = 1;
  // ゾロ目の2回目の時
  if (ten == one && i > 10){
    return 0;
  }
  while(num < N){
    num = one*pow(10, k) + j*10 +ten;
    if (num < N){
      if(num/(int)pow(10, k) == one && ten%(int)pow(10, k) ==ten){
        cout << i << " " << num << endl;
        cnt++;
      }
    }
    j++;
    if ((one+1)*pow(10,k) <= num || k==1) {
      j = 0;
      k++;
    }
  }
  if (ten == one){
    return cnt+1;
  }
  return cnt;
}

int main() {
  cin >> N;
  int cnt = 0;
  int len;
  int M = min(N, 99);
  vector<int> lst(N);


  for (int i = 1; i <=M; i++) {
    // cout << i << endl;
    // 1桁のものを入れていく
    // if (i < 10) cnt++;

    if (i % 10 == 0) continue; // 10で割れる場合は逆の数が存在しない
    else {
      len = solve(i, N);
      lst[i-1] = len;
    }
  }

  for(int i = 1; i <=M; i++) {
    int one = i%10;
    int ten = i/10;
    int num = one*10 + ten;

    else if (i % 10 == 0) continue; // 10で割れる場合は逆の数が存在しない
    if(i > 10) {
      if (one==ten) cnt+=lst[one];
      else cnt += lst[i-1] * lst[num-1];
    } else {
      cnt += lst[i-1];
    }
  }

  
  cout << cnt << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:5: error: 'else' without a previous 'if'
   72 |     else if (i % 10 == 0) continue; // 10で割れる場合は逆の数が存在しない
      |     ^~~~
Language: C++

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

vector<int> headsTail(int x){
  int tail = x % 10;
  while ((x / 10) != 0) {
    x /= 10;
  }
  int heads = x;
  vector<int> answer = {heads, tail};
  return answer;
}


int main(){
  int N;
  cin >> N;
  int sum = 0;
  vector<int> hta(2), htb(2);
  for (int A = 1; A <= N; A++) {
    hta = headsTail(A);
    for (int B = 1; B <= N; B++) {
      htb = headsTail(B);
      if (hta[0] == htb[1] && hta[1] == htb[0]) sum += 1;
    }
  }

  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc:4:19: error: declaration does not declare anything [-fpermissive]
    4 | typedef long long int;
      |                   ^~~
Language: C++

#include<iostream>
#include <stdio.h>
using namespace std;

int pow(int n){

        int ans = 1;
        for(int i=0;i<n;i++){
            ans *= 10;
        }

    return ans;

}

int first_num(int n){
    while(1){
        if(n/10==0){
            return n;
        }else{
            n = n / 10;
        }
    }
}

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

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

    int ans=0;
    int mat[10][10];

    for(int i=0 ;i<N;i++){
        for(int j=0;j<N;j++){
            mat[i][j]=0;
        }
    }

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

        mat[first_num(N)][last_num(N)] +=;

    }    

        for(int i=0 ;i<N;i++){
        for(int j=i;j<N;j++){
            ans += mat[i][j]* mat[i][j];
        }
    }

    cout << ans << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:42: error: expected primary-expression before ';' token
   46 |         mat[first_num(N)][last_num(N)] +=;
      |                                          ^
Language: C++


    return count;
}
int sentou(int aka){
  int kiiro=1;
    rep(i,keta(aka)-1){
    kiiro=kiiro*10;
  }
  return aka/kiiro;
}
int main() {
  int count=0,N,nketa,sen;
  int hyou[10][10];
  cin>>N;
  sen=sentou(N);
  nketa=keta(N);
/*  if(nketa<4){
    rep(i,N+1){
      rep(j,N+1){
        if(i%10 == sentou(j) and sentou(i)== j%10) count++;
      }
    }
  }*/
  for(int j=1;j<10;j++){
      for(int k=1;k<10;k++){
        hyou[j][k]=0;
      }
  }
  
  rep(i,N){
    hyou[i%10][sentou(i)]++;
  }
    for(int j=1;j<10;j++){
      for(int k=1;k<10;k++){
        count+=hyou[j][k]*hyou[k][j];
      }
    }
  for(int i=1;i<10;i++){
    count-=hyou[i][i]*hyou[i][i];
  cout<<count/2;
}


Compiler output:
a.cc:2:5: error: expected unqualified-id before 'return'
    2 |     return count;
      |     ^~~~~~
a.cc:3:1: error: expected declaration before '}' token
    3 | }
      | ^
a.cc: In function 'int sentou(int)':
a.cc:6:9: error: 'i' was not declared in this scope
    6 |     rep(i,keta(aka)-1){
      |         ^
a.cc:6:11: error: 'keta' was not declared in this scope
    6 |     rep(i,keta(aka)-1){
      |           ^~~~
a.cc:6:5: error: 'rep' was not declared in this scope
    6 |     rep(i,keta(aka)-1){
      |     ^~~
a.cc: In function 'int main()':
a.cc:14:3: error: 'cin' was not declared in this scope
   14 |   cin>>N;
      |   ^~~
a.cc:16:9: error: 'keta' was not declared in this scope; did you mean 'nketa'?
   16 |   nketa=keta(N);
      |         ^~~~
      |         nketa
a.cc:30:7: error: 'i' was not declared in this scope
   30 |   rep(i,N){
      |       ^
a.cc:30:3: error: 'rep' was not declared in this scope
   30 |   rep(i,N){
      |   ^~~
a.cc:40:3: error: 'cout' was not declared in this scope; did you mean 'count'?
   40 |   cout<<count/2;
      |   ^~~~
      |   count
a.cc:41:2: error: expected '}' at end of input
   41 | }
      |  ^
a.cc:11:12: note: to match this '{'
   11 | int main() {
      |            ^
Language: C++

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

// 桁数
int length(int i) {
  if (i<pow(10, 1)) return 1;
  else if (i<pow(10, 2)) return 2;
  else if (i<pow(10, 3)) return 3;
  else if (i<pow(10, 4)) return 4;
  else if (i<pow(10, 5)) return 5;
  else if (i<pow(10, 6)) return 6;
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i=1; i<=N; i++) {
    ans++;
    if (11*i<=N) ans++;
    string SN = to_string(N);
    int Nl = length(N); // Nの桁数
    if (Nl==6) {
      int p = 1; //積
      for (int i=1; i<6; i++) {
        p *= ctoi(S.at(i))+1;
      }
      ans += p+pow(10, 3)+pow(10, 2)+pow(10, 1);
    }
    for (int j=3; j<=6; j++) {
      if (Nl==j) {
        int p = 1;
        for (int k=1; k<j; k++) p *= ctoi(S.at(i))+1;
        ans += p;
        for (int k=1; k<=j-3; k++) {
          ans += pow(10, k);
        }
      }
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:19: error: 'S' was not declared in this scope
   33 |         p *= ctoi(S.at(i))+1;
      |                   ^
a.cc:40:43: error: 'S' was not declared in this scope
   40 |         for (int k=1; k<j; k++) p *= ctoi(S.at(i))+1;
      |                                           ^
a.cc: In function 'int length(int)':
a.cc:12:1: warning: control reaches end of non-void function [-Wreturn-type]
   12 | }
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>

int main(){
  int n;
  int a_low,a_top;
  int b;
  int i,j,k;
  int count=0;
  int pair[200000][200000]={{0},{0}};
  int ten[6]={0,10,100,1000,10000,100000}
  
  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
    a_low=i%10;
    a_top=i;
    for(j=0;j<6;j++){
      if(a_top>9){
        a_top=a_top/10;
      }
    }
    
    for(j=0;j<6;j++){
      b=a_low*ten[j]+a_top;
      if(j>1){
        for(k=0;k<ten[j];k++){
          b=b+k*10;
          if(pair[i][b]==0){
            if(i==b){
              pair[i][b]=1;
              count=count+1;
            } else {
              pair[i][b]=pair[b][i]=1;
              count=count+2;
            }
          }
        }
      }
    }
  }
  printf("%d",count);
}

Compiler output:
main.c: In function 'main':
main.c:13:3: error: expected ',' or ';' before 'scanf'
   13 |   scanf("%d",&n);
      |   ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep( i, n ) for (int i = 0; i < ( long long )(n); i++)
using namespace std;
int main(){
	long long n;
	long long ans = 0;
	vector < int > d( 5 );
	vector < int > dn( 5 );
	cin>>n;
	
	for( j = 0 ; j < 4 ; j++){
			dn.at( j ) = n / pow( 10, ( 5 - j ) );
		}
		dn.at( 4 ) = i % 10;
	int ndgt = log10( n );
	
	for(int i = 1 ; i < n ; i++){
		int dgt = log10( i );
		int fd = i % 10; 
		
		if(fd == 0) continue;
		
		if( fd == ( i /  pow( 10, dgt) ) ans++;
		
		if(dgt== 1) {
			ans++;
			continue;
		}
		if(fd == dn.at(4-ndgt+1)){
			
		}
		else{
		
		}
	}
	cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: 'j' was not declared in this scope
   11 |         for( j = 0 ; j < 4 ; j++){
      |              ^
a.cc:14:30: error: 'i' was not declared in this scope
   14 |                 dn.at( 4 ) = i % 10;
      |                              ^
a.cc:23:49: error: expected ';' before 'ans'
   23 |                 if( fd == ( i /  pow( 10, dgt) ) ans++;
      |                                                 ^~~~
      |                                                 ;
a.cc:25:17: error: expected primary-expression before 'if'
   25 |                 if(dgt== 1) {
      |                 ^~
a.cc:23:56: error: expected ')' before 'if'
   23 |                 if( fd == ( i /  pow( 10, dgt) ) ans++;
      |                   ~                                    ^
      |                                                        )
   24 | 
   25 |                 if(dgt== 1) {
      |                 ~~                                      
a.cc:35:9: error: expected primary-expression before '}' token
   35 |         }
      |         ^
Language: C

#include <stdio.h>

int rev(int number);
int main(void){
  int n;
  scanf("%d", &n);
  
  int count=0;
  int max=0;
  int reverse=0;
  for(int i=0; i<n; i++){
    if(i<10){
      count ++;
    }else if(i>10 && i<100){
      if(i%11==0) count = count+2;
      reverse = rev(i);
      if(reverse <= n) count++;
    }else if(i>100 && i<1000){
      if(i%111==0) count = count+3;
      reverse = rev(i);
      if(reverse <= n) count++;
    }else if(i>1000 && i<10000){
      if(i%1111==0) count = count+4;
      reverse = rev(i);
      if(reverse <= n) count++;
    }else if(i>10000 && i<100000){
      if(i%11111==0) count = count+5;
      reverse = rev(i);
      if(reverse <= n) count++;
    }else if(i>100000 && i<1000000){
      if(i%111111==0) count = count+6;
      reverse = rev(i);
      if(reverse <= n) count++;
    }
  }
  printf("%d", count);
  return 0;
}

int rev(int number){
while (number > 0) {
    reverse = reverse * 10 + number % 10;
    number /= 10;
  }
return reverse;
}

Compiler output:
main.c: In function 'rev':
main.c:42:5: error: 'reverse' undeclared (first use in this function)
   42 |     reverse = reverse * 10 + number % 10;
      |     ^~~~~~~
main.c:42:5: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

mport java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// スペース区切りの整数の入力
		int b = sc.nextInt();
      int count=0;
      for(int i=1;i<b;i++){
        for(int k=1;k<(b-(b%2))/2+1;k++){
        if(saijyoui(i)==saikai(k)&&saijyoui(k)==saikai(i)){
          if(i==k){
            count++
          }else{
            count+=2;
          }
        }
      }
      }
      System.out.println(count-1);
	}
  static int syou(int l,int n){
    int amari=l%n;
    return (l-amari)/n;
  }
  static int saijyoui(int n){
    int nyu=n;
    while(nyu>=10){
      nyu=syou(nyu,10);
    }
    return nyu;
  }
  static int saikai(int n){
    return n%10;
  }
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
Main.java:12: error: ';' expected
            count++
                   ^
2 errors
Language: C++

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

int ctoi(char c) {
  if (c == '0') {return 0;} 
  else if (c == '1') {return 1;}
  else if (c == '2') {return 2;}
  else if (c == '3') {return 3;}
  else if (c == '4') {return 4;}
  else if (c == '5') {return 5;}
  else if (c == '6') {return 6;}
  else if (c == '7') {return 7;}
  else if (c == '8') {return 8;}
  else if (c == '9') {return 9;}
  else {return 0;}
}

int ten(int n) {
  int k = 1;
  for (int i = 0; i < n; i++) {k = k * 10;}
  return k;
}
  

int main() {
  string N;
  cin >> N;
  int dofN = N.size();
  
  int a, b;
  int n, m;
  int num = 0;
  
  for (n = 0; n+2 < dofN; n++) {
    for (m = 0; m+2 < dofN; m++) {
      num = num + ten(n) * ten(m);
    }
    
    
    if (b < ctoi(N.at(0)))
    
    
  }
  

}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:3: error: expected primary-expression before '}' token
   43 |   }
      |   ^
Language: C++

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
 
using namespace std;
using namespace __gnu_pbds;
 
// template<typename T>
using o_set=tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define M 1000010

ll a[11][11];
int main(){
	IOS;
	ll n;cin>>n;
	ll ans=0;
	rep(i,1,n+1){
		string s=to_string(i);
		ll ini=s[0]-'0',las=s[sz(all)-1]-'0';
		a[ini][las]++;
	}
	rep(i,1,11)rep(j,1,11)ans+=a[i][j]*a[j][i];
	cout<<ans;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:42: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   39 |                 ll ini=s[0]-'0',las=s[sz(all)-1]-'0';
      |                                          ^~~
a.cc:13:16: note: in definition of macro 'sz'
   13 | #define sz(v) (v).size()
      |                ^
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
Language: C

n = gets.to_i
result = 0

n.times do |i|
  i_s = (i+1).to_s
  n.times do |j|
    j_s = (j+1).to_s
    if i_s[0] == j_s[-1] && i_s[-1] == j_s[0]
      result += 1
    end
  end
end

print result

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n = gets.to_i
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:5: error: 'gets' undeclared here (not in a function)
    1 | n = gets.to_i
      |     ^~~~
main.c:2:1: error: expected ',' or ';' before 'result'
    2 | result = 0
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int keta(int n){
  int ans=0;
  while(n>0){
    ans++;
    n/=10;
  }
  return ans;
}
int main() {
  int n;
  cin>>n;
  int ans=0;
  for(int i=1;i<=n;i++){
    int a=i/pow(10,keta(i)-1);
    int b=i%10;
    int d=n/pow(10,keta(n)-1);
    int e=n%10;
    int c=keta(n)-2;
    if(a!=0 && b!=0){
      if(a==b){
    if(a<=n) ans++;
  }
  if(10*b+a<=n) ans++;
    for(int i=1;i<=c;i++){
      if(i!=c) ans+=pow(10,i);
      else {
        if(d>b){
          ans+=pow(10,i);
        }
        else if(d==b){
          int aho=pow(10,keta(n)-1);
          int hina=n%aho;
          ans+=hina/10;
          if(e>=A) ans++;
        }
      }
    }
    }
  } 
  
  cout<<ans<<endl;          
          
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:17: error: 'A' was not declared in this scope
   36 |           if(e>=A) ans++;
      |                 ^