use std::io::{self, BufRead}; const fn should_output(mut n: usize) -> bool { if n % 3 == 0 { true } else { while n > 0 { if n % 10 == 3 { return true; } n /= 10; } false } } fn main() { let input = io::stdin() .lock() .lines() .flat_map(|l| { l.unwrap() .split_whitespace() .map(|n| n.parse::().unwrap()) .collect::>() }) .collect::>(); (input[0]..=input[1]) .filter(|&n| should_output(n)) .for_each(|n| println!("{}", n)); }