Revenge2024 @ 2023-11-30 12:55:46
#include <math.h>
#include <iostream>
using namespace std;
int m,n,re=0;
bool gys(int a,int b){
int k=a;
while(a%k!=0||b%k!=0){
k=k-m;
if(k<m) return false;
}
return k==m;
}
bool gbs(int a,int b){
int k=a;
while(k%a!=0||k%b!=0){
k=k+m;
if(k>n) return false;
}
return k==n;
}
int main(){
int i,j,w;
cin>>m>>n;
w=sqrt(n);
if(m==n) cout<<1;
else{
for(i=m;i<n;i=i+m){
for(j=i+m;j<=n;j=j+m){
if(i<w&&j<w) continue;
if(n%j!=0||n%i!=0) continue;
if(gys(i,j)&&gbs(i,j)){
re++;
}
}
}
cout<<re*2;
}
return 0;
}