#include using namespace std; bool ok(int s) { if (s%3 == 0) { return true; } while (s) { if (s%10 == 3) { return true; } s /= 10; } return false; } int main() { int A, B; cin >> A >> B; for (int i = A; i <= B; ++i) { if (ok(i)) { cout << i << endl; } } }