Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- unsigned long long n, k;
- cin >> n >> k;
- if (n>=k) {
- cout << k-1;
- return 0;
- }
- else cout <<2*n-k+1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment