#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; vector divisor(ll x){ set s; for(ll i=1;i*i<=x;i++){ if(x%i==0){ s.insert(i); s.insert(x/i); } } vector res; for(auto y:s) res.push_back(y); return res; } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int t; cin>>t; while(t--){ ll S,T; cin>>S>>T; if(16*S*S%T!=0){ cout<<0< A=divisor(U); sort(ALL(A)); int n=A.size(); set>> s; rep(i,n){ if((T-A[i])%2==1) continue; for(int j=i;jlog(U)+1e5) continue; if(A[i]*A[j]*A[k]!=U) continue; if(A[i]+A[j]+A[k]!=T) continue; if(A[j]+A[k]>=T+A[i]) continue; s.insert({(T-A[i])/2,{(T-A[j])/2,(T-A[k])/2}}); } } } cout<