cf/mirror

Nearest Beautiful Number (hard version)

CF
1560F22100· master1s256 MB⌨ stdin/stdout

Examples

Sample 1of 1
Input
6
2021 3
177890 2
34512 3
724533 4
998244353 1
12345678 10
Output
2021
181111
34533
724542
999999999
12345678
1560F2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…