// Telebe of adicto yani AzeTurk810
//
// WHY ARE YOU STARING MY CODE Stranger ??!!
//
//GO AWAY AND DON T look my CODE if i don t know you or you are stalker !!!!(hrrr)
//
// here about me: I am alone of course, fun , ' , ' , love pyhcics , young(child) , love music , had birds , not a gamer , chess :) , dead to football , you are looking to code , ... ;
//
// why at 1 japon army march they say "the enemy geniral is a hero , an equal to no one. Both in glory and in victory
// the men that follow him are also brave , fearless wariors ..."?
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
# define ln '\n'
# define INFi 1e9
# define INFll 1e18
# define MOD int(1e9 + 7)
ll sum(ll a , ll b) {
return ((a + b) * (b - a + 1))/2;
}
vector<ll> lvl;
ll mult(ll a , ll b) {
return (a * b)%MOD;
}
void solve() {
ll k;
int n;
cin >> n >> k;
lvl.resize(n + 1);
lvl[0] = 1;k--;
for(int i = 1 ; i <= n ; i ++) {
lvl[i] = mult(lvl[i - 1 ] , 2);
}
ll ans = 1;
for(int i = 0 ; i < min(n , 60) ; i ++) {
if((1LL << i) & k) {
ans += lvl[n - i - 1];
ans %= MOD;
}
}
cout << ans << ln;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
while(t--)solve();
}
/*
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |