#include #include #define REP(i,a,b) for(i=a;i1) p[ps] = N, np[ps] = 1, ps++; nd = 1; rep(i,ps) nd *= np[i]+1; while(Q--){ /* assert( scanf("%d%lld",&T,&K)==2 );*/ T = int_read(); K = ll_read(); assert( 1<=T && T<=3 ); assert( 1LL<=K && K<=1000000000000LL ); rep(i,ps){ kp[i] = 0; while(kp[i] < np[i] && K>=p[i] && K%p[i]==0) kp[i]++, K/=p[i]; } if(T==1){ res = 1; rep(i,ps) res *= kp[i]+1; printf("%d\n",res); continue; } res = 0; if(K==1){ res = 1; rep(i,ps){ j = np[i] - kp[i]; if(j<0){ res=0; break; } res *= j+1; } } if(T==3) res = nd - res; printf("%d\n",res); } return 0; }