template<int a, int b, int c> structNumberEach3 { staticinlinevoidprint(){ IfPrint<Check<a, b, c>::result, a * 100 + b * 10 + c>::print(); NumberEach3<a, b, c + 1>::print(); } };
template<int a, int b> structNumberEach3<a, b, 9> { staticinlinevoidprint(){ IfPrint<Check<a, b, 9>::result, a * 100 + b * 10 + 9>::print(); } };
template<int a, int b> structNumberEach2 { staticinlinevoidprint(){ NumberEach3<a, b, 1>::print(); NumberEach2<a, b + 1>::print(); } };
template<int a, int n> structGetDigit { staticconstint result = (a / Pow10<n>::result) % 10; };
template<int first, int second, int ...other> structCheckDigit { staticconstbool result = CheckDigit<first, second>::result && CheckDigit<first, other...>::result; };
template<int first, int second> structCheckDigit<first, second> { staticconstbool result = (first != second && first != 0); };
template<int first, int second, int ...other> structCheckDigitAll { staticconstbool result = CheckDigit<first, second, other...>::result && CheckDigitAll<second, other...>::result; };
template<int first, int second> structCheckDigitAll<first, second> { staticconstbool result = CheckDigit<first, second>::result; };
template<int a, int b, int c> structCheck { staticconstint v0 = a * 100 + b * 10 + c, v1 = v0 * 2, v2 = v0 * 3; staticconstbool result = CheckDigitAll<GetDigit<v0, 2>::result, GetDigit<v0, 1>::result, GetDigit<v0, 0>::result, GetDigit<v1, 2>::result, GetDigit<v1, 1>::result, GetDigit<v1, 0>::result, GetDigit<v2, 2>::result, GetDigit<v2, 1>::result, GetDigit<v2, 0>::result>::result; };
template<int a, int b, int c> structNumberEach3 { staticinlinevoidprint(){ IfPrint<Check<a, b, c>::result, a * 100 + b * 10 + c>::print(); NumberEach3<a, b, c + 1>::print(); } };
template<int a, int b> structNumberEach3<a, b, 9> { staticinlinevoidprint(){ IfPrint<Check<a, b, 9>::result, a * 100 + b * 10 + 9>::print(); } };
template<int a, int b> structNumberEach2 { staticinlinevoidprint(){ NumberEach3<a, b, 1>::print(); NumberEach2<a, b + 1>::print(); } };