/** @file main.cpp @title No.864 四方演算 @url https://yukicoder.me/problems/no/864 **/ #include using namespace std; typedef long long LL; #define ALL(obj) (obj).begin(), (obj).end() #define REP(i, N) for (int i = 0; i < (N); ++i) vector make_divisors(uint n) { vector divisors; for (uint i = 1; i <= sqrt(n) + 1; i++) { // for (uint i = 1; i * i <= n; i++) { if (n % i == 0) { divisors.push_back(i); divisors.push_back(n / i); } } sort(ALL(divisors)); divisors.erase(unique(divisors.begin(), divisors.end()), divisors.end()); return divisors; } uint seps(uint q, uint N) { if (2 <= q && q <= N + 1) { return q - 1; } else if (N + 2 <= q && q <= 2 * N) { return 2 * N + 1 - q; } else { return 0; } } template void show(vector& v) { for (uint i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << "\n"; } int main() { uint N, K; cin >> N >> K; vector divs = make_divisors(K); // show(divs); LL ans = 0; for (auto i : divs) { if (i == 1 || i == K) { continue; } uint j = K / i; // cout << seps(i, N) << " , " << seps(j, N) << "\n"; ans += seps(i, N) * seps(j, N); } cout << ans << endl; return 0; }