func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int w, m;     cin >> w >> m;     if (m == 1 || w == 2) {       cout <<  YES  << endl;       return 0;     }     while (m) {       if (m % w == 1) {         --m;       } else if (m % w == w - 1) {         ++m;       }       if (m % w == 0) {         m /= w;       } else {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;     return 0;   }   