#include using namespace std; #define int long long templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> s; while(s--) yta(); return 0; } int x, y; inline int valid(int a){ if(a == 0) return 0; int sita = a*a-1; int ue = a*x-y; if(sita == 0 || ue <= 0 || ue%sita != 0) return 0; int b = ue/sita; if(x-a*b <= 0) return 0; return 1; } int yta(){ cin >> x >> y; int ans = 0; for(int i = 1;i*i <= x+y;i++){ if((x+y)%i == 0){ ans += valid(i-1); if(i*i < x+y) ans += valid((x+y)/i-1); } } cout << ans << endl; return 0; }