#include #include #define REP(i, a, b) for (int i = (a); i < (b); i++) #define dump(s) cerr << __LINE__ << "\t:" << #s << " = " << (s) << endl using namespace std; int main () { int A, B; cin >> A >> B; auto chk = [](int num) -> bool { do { if (num % 10 == 3) return true; num /= 10; } while (num > 0); return false; }; REP (n, A, B + 1) { if (chk(n) || n % 3 == 0) { cout << n << endl; } } return 0; }