-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathABC349D.cpp
More file actions
28 lines (28 loc) · 749 Bytes
/
ABC349D.cpp
File metadata and controls
28 lines (28 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <bits/extc++.h>
using namespace std;
namespace pbds = __gnu_pbds;
using ui = unsigned int;
using uli = unsigned long long int;
using li = long long int;
template <typename T> T lowbit(T x) { return x & -x; }
int main(void) {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
uli x, y;
cin >> x >> y;
uli i = x, j;
vector<pair<uli, uli>> ans;
if (x != 0)
for (j = x + lowbit(x); j < y; i = j, j += lowbit(j))
ans.emplace_back(i, j);
j = i;
uli k = uli(1) << uli(63);
while (j < y) {
while (j + k > y) k >>= 1;
i = j, j = j + k;
ans.emplace_back(i, j);
}
cout << ans.size() << '\n';
for (pair<uli, uli> const& a : ans)
cout << a.first << ' ' << a.second << '\n';
return 0;
}