Advertisement
Guest User

Untitled

a guest
Mar 13th, 2019
1,968
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define int long long
  4. signed main() {
  5. #ifdef HOME
  6. freopen("input.txt", "r", stdin);
  7. #else
  8. ios_base::sync_with_stdio(0); cin.tie(0); cout.precision(20);
  9. #endif
  10. int n, p;
  11. cin >> n >> p;
  12. cout << (2 * n + 1) + (n - 1) + min(p - 1, n - p) << '\n';
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement