#ifndef ONLINE_JUDGE #define _GLIBCi_DEBUG #endif //#pragma GCC optimize("Ofast") //#pragma GCC optimize "O3,omit-frame-pointer,inline" #include // cout, endl, cin #include // string, to_string, stoi #include // vector #include // min, mai, swap, sort, reverse, lower_bound, upper_bound #include // pair, make_pair #include // tuple, make_tuple #include // int64_t, int*_t #include // printf #include // map #include // queue, priority_queue #include // set #include // stack #include // deque #include // unordered_map #include // unordered_set #include // bitset #include // isupper, islower, isdigit, toupper, tolower #include // fiied,setprecision #include // INT_MAi #include // M_PI #include // random_device, mt19937, uniform_int_distribution #include // 正規表現 #include // time #include // ifstream, ofstream #include // array #include // bit #include // chrono #include // span #include // sqrt, sin, cos, tan, asin, acos, atan, atan2 #include // 複素数 //#include using namespace std; #include using namespace atcoder; //using mint = modint1000000007; using mint = modint998244353; using ll = long long; using ull = unsigned long long; using ld = long double;//80bit 18桁 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) const int dx[4] = {-1, 0, 1, 0}; const int dy[4] = { 0, 1, 0,-1}; const string DIR="URDL"; const int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1}; const int dy8[8] = {1, 1, 0, -1, -1, -1, 0, 1}; //INFに3以上を掛ける、またはint(INF)に1以上を足すとオーバーフローする //4611686016279904255 cf: LLONG_MAi=9223372036854775807 //const ll INF = (1ll << 62) - (1ll << 31) - 1ll; int main(){ ll k,n; cin>>k>>n; setnum; int ans=0; for(ll x=1;x<=316;x++){ for(ll y=1;y<=5623;y++){ ll x6=x*x*x*x*x*x; ll y4=y*y*y*y; if(x6+y4>n)break; ll z=(x6+y4)/k; ll z1=sqrt(z); if(z1*z1!=z||z==0)continue; if((x6+y4)%k!=0)continue; //cerr<