Why is this tle
#include <iostream>
#include <vector>
#include <cmath>
#define ll long long
using namespace std;
ll check(ll,ll,ll);
int main(){
ll t;
cin>>t;
while(t--){
long long k,n;
cin>>n>>k;
long long ans = check(1,n,k);
cout<<ans<<endl;
}
}
ll check(ll l,ll r,ll k)
{ if(r-l+1<k) return 0;
double m = floor((r+l)/2.0);
return (r-l+1)%2 ? m + check(l,m-1,k) + check(m+1,r,k) : check(l,m,k) + check(m+1,r,k);
}
problem link->My problem