Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
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;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> dp(21000000);

    for (int i = 0; i < 21000000; i++) dp[i] = 0;

    dp[0] = 0;

    for (ll idx = 1; dp[idx - 1] != N; idx++){
      for (ll i = 9; dp[idx - 1] + i <= N; i = i * 9) {
          dp[idx] = dp[idx - 1] + i;
          //cout << i << endl;
      }
      //cout << "idx1 " <<dp[idx] << endl;
      for (ll j = 6; (dp[idx - 1] + j <= N); j= j * 6){
          if(dp[idx-1]+j>dp[idx]) dp[idx] = dp[idx - 1] + j;
          //cout << j << endl;
      }
      //cout << "idx2 " << dp[idx] << endl;
      if (dp[idx - 1] + 1 <= N && dp[idx - 1] + 1 > dp[idx])
        dp[idx] = dp[idx - 1] + 1;
    //cout <<"dp " <<dp[idx] << endl;
    }

    ll cnt = 0;
    for (int i = 1; dp[i] != 0; i++) cnt++;
    cout << cnt << endl;
    return 0;
}#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
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;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> dp(21000000);

    for (int i = 0; i < 21000000; i++) dp[i] = 0;

    dp[0] = 0;

    for (ll idx = 1; dp[idx - 1] != N; idx++){
      for (ll i = 9; dp[idx - 1] + i <= N; i = i * 9) {
          dp[idx] = dp[idx - 1] + i;
          //cout << i << endl;
      }
      //cout << "idx1 " <<dp[idx] << endl;
      for (ll j = 6; (dp[idx - 1] + j <= N); j= j * 6){
          if(dp[idx-1]+j>dp[idx]) dp[idx] = dp[idx - 1] + j;
          //cout << j << endl;
      }
      //cout << "idx2 " << dp[idx] << endl;
      if (dp[idx - 1] + 1 <= N && dp[idx - 1] + 1 > dp[idx])
        dp[idx] = dp[idx - 1] + 1;
    //cout <<"dp " <<dp[idx] << endl;
    }

    ll cnt = 0;
    for (int i = 1; dp[i] != 0; i++) cnt++;
    cout << cnt << endl;
    return 0;
}

Compiler output:
a.cc:51:2: error: stray '#' in program
   51 | }#include <bits/stdc++.h>
      |  ^
a.cc:51:3: error: 'include' does not name a type
   51 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:54:17: error: redefinition of 'const long long int INF'
   54 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:4:17: note: 'const long long int INF' previously defined here
    4 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:56:13: error: redefinition of 'template<class T> bool chmin(T&, T)'
   56 | inline bool chmin(T& a, T b) {
      |             ^~~~~
a.cc:6:13: note: 'template<class T> bool chmin(T&, T)' previously declared here
    6 | inline bool chmin(T& a, T b) {
      |             ^~~~~
a.cc:64:13: error: redefinition of 'template<class T> bool chmax(T&, T)'
   64 | inline bool chmax(T& a, T b) {
      |             ^~~~~
a.cc:14:13: note: 'template<class T> bool chmax(T&, T)' previously declared here
   14 | inline bool chmax(T& a, T b) {
      |             ^~~~~
a.cc:72:5: error: redefinition of 'int main()'
   72 | int main(){
      |     ^~~~
a.cc:22:5: note: 'int main()' previously defined here
   22 | int main(){
      |     ^~~~