// compile: g++ -o data data.cpp -std=gnu++20
// run: ./data < data.in
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define int long long
using namespace std;
int get_lucky(int x) {
int minv = 11, maxv = -1;
for (; x; x /= 10) {
minv = min(minv, x % 10);
maxv = max(maxv, x % 10);
}
return maxv - minv;
}
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int _; cin >> _;
while (_--) {
int l, r;
cin >> l >> r;
int maxv = -1, maxind = 0;
for (int i = l; i <= r; ++i) {
if (get_lucky(i) > maxv) {
maxv = get_lucky(i);
maxind = i;
}
if (maxv == 9) break;
}
cout << maxind << endl;
}
return 0;
}
Gonna try out winpkrgame. Sounds like a good time. Let the games begin. Join and play today winpkrgame!
B52dangnhap, eh? Nghe nói vào đây chơi là phê pha lắm đó nha. Anh em nào thích cảm giác mạnh thì quất liền đi, đừng bỏ lỡ cơ hội! Check it out b52dangnhap
789win13? Don’t know much, but I’m always down to try something new! Let me know if anyone has tried it already? Check it out: 789win13
Just what I was looking for. Easy navigation and very responsive on all my devices. I’ll be coming back to bd7c7775 for sure
Quick deposits and even quicker withdrawals. It’s hard to find a site as efficient as 393betcc these days. Highly satisfied!
Solid experience overall. The graphics are crisp and the navigation is very intuitive for new players. Love 4444wim
Super happy with the rewards program here. It really keeps things exciting and gives you more value for your time. phbet100com is the real deal.
The jackpots here are insane! I love how easy it is to navigate the site on my phone. Big thanks to phjilihot777 for the awesome vibes.
[2815]betsul লগইন এবং অ্যাপ ডাউনলোড | বিকাশ ক্যাসিনো ডিপোজিট,betsul লগইন করার নিয়ম জানুন এবং অ্যাপ ডাউনলোড করে অনলাইন স্লট গেম খেলার নিয়ম শিখে নিন। বিকাশ দিয়ে ক্যাসিনো ডিপোজিট করে আজই গেম শুরু করুন। visit: betsul
The login process is super fast and secure. I appreciate how straightforward the dashboard is on 77bbbetlogin. Makes gaming much more enjoyable.