Language: C++

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20)
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007LL;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
llint LBI(vector<int>&ar,int in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
llint UBI(vector<int>&ar,int in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	llint h,i,j,n;cin>>n;
	//O(n^(log2/log6))
	//O(n^0.387)
	//3の倍数の下bitから決めていく(典型)
	vector<int>dp(9,9999);
	dp[0]=0;
	llint rok=1;//6の累乗/3の累乗
	for(h=0;;h++){
		if(h%2==0){
			//+1できる
			for(i=1;i<dp.size();i++){mineq(dp[i],dp[i-1]+1);}
		}
		//5つまで+rokできる
		for(i=rok;i<dp.size();i++){mineq(dp[i],dp[i-rok]+1);}
		int ama=n%3;
		n/=3;
		rok*=2;
		vector<int>ddp;
		int nesiz=min((llint)n+2,(llint)10+rok*5+(dp.size()+5-ama)/3);
		ddp.resize(nesiz);
		for(i=ama;i<dp.size();i+=3){ddp[i/3]=dp[i];}
		for(i/=3;i<ddp.size();i++){ddp[i]=9999;}
		dp=move(ddp);
		if(n==0){break;}
	}
	cout<<dp[0]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:30: error: no matching function for call to 'min(llint, long long unsigned int)'
   71 |                 int nesiz=min((llint)n+2,(llint)10+rok*5+(dp.size()+5-ama)/3);
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/deque:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:71:30: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   71 |                 int nesiz=min((llint)n+2,(llint)10+rok*5+(dp.size()+5-ama)/3);
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:71:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   71 |                 int nesiz=min((llint)n+2,(llint)10+rok*5+(dp.size()+5-ama)/3);
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~