筛就完了。

#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    ll n, x;
    cin >> n >> x;

    ll cnt = 0;
    for (ll i = 1; i * i <= x; i++) {
        if (x % i == 0) {
            if (i <= n) cnt++;
            ll d = x / i;
            if (d != i && d <= n) cnt++;
        }
    }

    if (cnt % 2 == 0) cout << "OFF\n";
    else cout << "ON\n";
    return 0;
}