malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int t[6000020][2], tt;   void ins(long long x) {     int p = 0;     for (int i = 40; i--;) {       if (!t[p][x >> i & 1]) t[p][x >> i & 1] = ++tt;       p = t[p][x >> i & 1];     }   }   long long qy(long long x) {     long long z = 0;     int p = 0;     for (int i = 40; i--;) {       if (t[p][~x >> i & 1])         z += 1LL << i, p = t[p][~x >> i & 1];       else         p = t[p][x >> i & 1];     }     return z;   }   int n;   long long a[100020];   long long ans;   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %I64d , a + i);     long long w = 0;     ins(w);     for (int i = 0; i < n; i++) ins(w ^= a[i]);     for (int i = 0; i < n; i++) ans = max(ans, qy(w ^= a[i]));     printf( %I64d , ans);   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   const int MAXN = 5e2 + 10;   int n, m;   long long adj[MAXN][MAXN];   long long adj_[MAXN][MAXN];   int ans[MAXN][MAXN];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     memset(adj, 63, sizeof(adj));     memset(adj_, 63, sizeof(adj_));     for (int i = 0; i < m; i++) {       int u, v, l;       cin >> u >> v >> l;       adj[u][v] = adj[v][u] = l;       adj_[u][v] = adj_[v][u] = l;     }     for (int i = 1; i <= n; i++) adj[i][i] = 0;     for (int k = 1; k <= n; k++)       for (int i = 1; i <= n; i++)         for (int j = 1; j <= n; j++)           adj[i][j] = min(adj[i][j], adj[i][k] + adj[j][k]);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         for (int k = 1; k <= n; k++)           if (adj_[k][j] < 1e9 && (adj[i][k] + adj_[k][j]) == adj[i][j])             ans[i][j]++;     for (int i = 1; i < n; i++)       for (int j = i + 1; j <= n; j++) {         int answer = 0;         for (int k = 1; k <= n; k++)           if ((adj[i][k] + adj[k][j]) == adj[i][j]) answer += ans[i][k];         cout << answer <<    ;       }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ask(int i, int j) {     cout <<  ?   << i <<     << j << endl;     fflush(stdout);     int val;     cin >> val;     return val;   }   int main() {     int n;     cin >> n;     int a[n + 1];     int index = 1, i, x, y;     for (int i = 2; i <= n; i++) {       x = ask(index, i);       y = ask(i, index);       if (x > y) {         a[index] = x;         index = i;       } else if (y > x) {         a[i] = y;       }     }     a[index] = n;     cout <<  !  ;     for (i = 1; i <= n; i++) cout << a[i] <<    ;     cout <<   n ;     fflush(stdout);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   long long n, m, s, t;   long long pos[maxn], T[maxn];   long long cal(long long x) {     if (s < m)       s += t;     else       s -= t;     t--;     return (s % n + n) % n;   }   int main() {     cin >> n >> m >> s >> t;     s--;     while (t % n) s = cal(s);     long long temp = t / n;     long long tick = 0;     while (temp--) {       if (pos[s]) {         temp %= tick - T[s];         s = pos[s];       } else {         T[s] = tick;         long long tmp = s;         t = n;         for (int i = 1; i <= n; i++) s = cal(s);         pos[tmp] = s;         tick++;       }     }     cout << s + 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool done[1010];   int l[1010], r[1010], ans[1010];   int main() {     int n, i, j, k;     scanf( %d , &n);     int rem = n;     for (i = 0; i < n; i++) {       scanf( %d , &l[i]);       done[i] = 0;     }     for (i = 0; i < n; i++) scanf( %d , &r[i]);     int maxx = n;     while (1) {       set<int> S;       bool over = 1;       for (i = 0; i < n; i++) {         if (done[i] == 0) {           over = 0;           if (l[i] == 0 and r[i] == 0) {             S.insert(i);           }         }       }       if (over) break;       int sz = S.size();       if (sz == 0) {         cout <<  NO  << endl;         return 0;       }       set<int>::iterator it;       for (it = S.begin(); it != S.end(); it++) {         int idx = *it;         ans[idx] = maxx;         for (j = idx - 1; j >= 0; j--) {           if (done[j] == 0 and S.find(j) == S.end()) {             if (r[j] == 0) {               cout <<  NO  << endl;               return 0;             }             r[j]--;           }         }         for (j = idx + 1; j < n; j++) {           if (done[j] == 0 and S.find(j) == S.end()) {             if (l[j] == 0) {               cout <<  NO  << endl;               return 0;             }             l[j]--;           }         }       }       for (it = S.begin(); it != S.end(); it++) {         done[*it] = 1;       }       maxx--;     }     cout <<  YES  << endl;     for (i = 0; i < n; i++) cout << ans[i] <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int ans;   bool one, two, three;   vector<int> v;   int main() {     scanf( %d , &n);     while (one == false || two == false || three == false) {       for (int i = 1; i <= n; i++) {         if (!one) {           if (i % 2 == 0) {             ans++;             v.push_back(i);           }           if ((n % 2 == 0 && i == n) || (n % 2 != 0 && i == n - 1)) {             one = true;             break;           }         } else if (!two) {           if (i % 2 != 0) {             ans++;             v.push_back(i);           }           if ((n % 2 != 0 && i == n) || (n % 2 == 0 && i == n - 1)) {             two = true;             break;           }         } else if (!three) {           if (i % 2 == 0) {             ans++;             v.push_back(i);           }           if ((n % 2 == 0 && i == n) || (n % 2 != 0 && i == n - 1)) {             three = true;             goto A;           }         }       }     }   A:     printf( %d n , ans);     for (int i = 0; i < v.size(); i++) {       printf( %d  , v[i]);     }   }
#include <bits/stdc++.h>   const long long MaxN = 1e5 + 50;   template <class t>   inline void read(t &s) {     s = 0;     register long long f = 1;     register char c = getchar();     while (!isdigit(c)) {       if (c ==  - ) f = -1;       c = getchar();     }     while (isdigit(c)) s = (s << 3) + (s << 1) + (c ^ 48), c = getchar();     s *= f;     return;   }   template <class t, class... A>   inline void read(t &x, A &...a) {     read(x);     read(a...);   }   template <class t>   inline void write(t x) {     if (x < 0) putchar( - ), x = -x;     long long buf[21], top = 0;     while (x) buf[++top] = x % 10, x /= 10;     if (!top) buf[++top] = 0;     while (top) putchar(buf[top--] ^  0 );     return;   }   inline void setIn(std::string s) {     freopen(s.c_str(),  r , stdin);     return;   }   inline void setOut(std::string s) {     freopen(s.c_str(),  w , stdout);     return;   }   inline void setIO(std::string s =   ) {     setIn(s +  .in );     setOut(s +  .out );     return;   }   template <class t>   inline bool ckmin(t &x, t y) {     if (x > y) {       x = y;       return 1;     }     return 0;   }   template <class t>   inline bool ckmax(t &x, t y) {     if (x < y) {       x = y;       return 1;     }     return 0;   }   inline long long lowbit(long long x) { return x & (-x); }   std::vector<long long> E[MaxN];   long long f[MaxN], g[MaxN], up[MaxN][21], dep[MaxN], s[MaxN][21], to[MaxN],       a[MaxN], n, L, S;   inline void dfs(long long u, long long fa) {     up[u][0] = fa, dep[u] = dep[fa] + 1;     for (auto v : E[u])       if (v != fa) s[v][0] = a[u], dfs(v, u);   }   inline void dfs2(long long u, long long fa) {     f[u] = -1;     for (auto v : E[u])       if (v != fa) dfs2(v, u), ckmax(f[u], f[v] - 1), g[u] += g[v];     if (!~f[u]) f[u] = to[u], ++g[u];   }   signed main(void) {     read(n, L, S);     if (!L) return std::puts( -1 ), 0;     for (long long i = 1; i <= n; ++i) {       read(a[i]);       if (a[i] > S) return std::puts( -1 ), 0;     }     register long long v;     for (long long i = 2; i <= n; ++i)       read(v), E[i].push_back(v), E[v].push_back(i);     dfs(1, 0);     for (long long k = 1; k < 21; ++k)       for (long long i = 1; i <= n; ++i)         up[i][k] = up[up[i][k - 1]][k - 1],         s[i][k] = s[i][k - 1] + s[up[i][k - 1]][k - 1];     for (long long i = 1; i <= n; ++i) {       register long long pos = i, nl = 0, ns = a[i];       for (long long k = 20; ~k; --k)         if (up[pos][k] && nl + (1 << k) < L && ns + s[pos][k] <= S)           nl += (1 << k), ns += s[pos][k], pos = up[pos][k];       to[i] = nl;     }     dfs2(1, 0);     write(g[1]), std::puts(  );     return 0;   }
//SAGAR SINGH   // #pragma GCC optimize( Ofast )   // #pragma GCC target( avx,avx2,fma )   // #pragma GCC optimization( unroll-loops )   #include<bits/stdc++.h>   using namespace std;   #define fastio ios_base::sync_with_stdio;cin.tie(NULL);cout.tie(0);   #define ll long long    #define ld long double    #define rep(i,a,b) for(ll i=a;i<b;i++) //rep(i,0,n)    #define repr(i,a,b) for(ll i=a;i>=b;i--)//repr(i,n-1,0)   #define repit(it,a) for(auto it=(a).begin();it!=(a).end();it++)//repr(i,n,0)   #define vll vector<long long>   #define vpl vector<pair<ll,ll> >   #define sll set<long long>   #define msll multiset<long long>   #define mll map<ll,ll>   #define mmll multimap<ll,ll>   #define all(x) x.begin(),x.end()   #define rall(x) x.rbegin(),x.rend()   #define get(x) getline(cin,x)   #define in(v) for(auto &x:v) cin>>x;   #define out(v) for(auto x:v) {cout<<x<<   ;} cout<<  n ;   #define str string   #define pb  push_back   #define ins insert   #define lb lower_bound   #define ub upper_bound   #define ff first   #define ss second   /*--- bit-stuff ----*/   #define setbits(a) ( __builtin_popcountll(a))   #define right(a) (__builtin_ctzll(a))   #define left(a) (__builtin_clzll(a))   #define parity(a) (__builtin_parityll(a))      #define TRACE   #ifdef TRACE   #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)       template <typename Arg1>       void __f(const char* name, Arg1&& arg1){           cout << name <<   :   << arg1 << endl;           //use cerr if u want to display at the bottom       }       template <typename Arg1, typename... Args>       void __f(const char* names, Arg1&& arg1, Args&&... args){           const char* comma = strchr(names + 1,  , ); cout.write(names, comma - names) <<   :   << arg1<<  |  ;__f(comma+1, args...);       }   #else   #define trace(...)   #endif         const ll mod = 1e9+7;   const ll N = 1e5+1;   const ll INF = 1e18;   const ll NINF = -1e18;         void solve(){      ll n;cin>>n;   vll v(n);in(v);      str s;   rep(i,0,n) s.pb( 0 );      ll cur=0;   ll i=n-1;      while(i>=0){    cur=max({cur,v[i],(ll)0});     if(cur>0) s[i]= 1 ;     else s[i]= 0 ;     i--;     cur--;   }      out(s);                     }      int main(){     ios_base::sync_with_stdio;     cin.tie(NULL);cout.tie(0);     ll t=1;     cin>>t;     while(t--)        solve();        return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   long long N, K;   int M;   vector<long long> special;   int sol = 0;   int main() {     scanf( %lld %d %lld , &N, &M, &K);     for (int i = 0; i < M; i++) {       long long v;       scanf( %lld , &v);       special.push_back(v);     }     int curr = 0, add = 0;     while (curr < M) {       sol++;       long long v = special[curr];       v--;       v -= (long long)add;       long long page = v / K;       long long en = K + K * page;       long long toAdd = 0;       while (curr < M && special[curr] - add <= en) {         curr++;         toAdd++;       }       add += toAdd;     }     printf( %d n , sol);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename t>   t in(t q) {     cin >> q;     return q;   }   template <typename T>   ostream& operator<<(ostream& os, const vector<T>& v) {     os <<  [ ;     for (int i = 0; i < ((int)size(v)); ++i) {       os << v[i];       if (i != ((int)size(v)) - 1) os <<  , ;     }     os <<  ] ;     return os;   }   template <typename T, typename S>   ostream& operator<<(ostream& os, const map<T, S>& v) {     for (auto it : v) os <<  (  << it.first <<  :  << it.second <<  ) ;     return os;   }   template <typename T, typename S>   ostream& operator<<(ostream& os, const pair<T, S>& v) {     os <<  (  << v.first <<  ,  << v.second <<  ) ;     return os;   }   const long double PI = acosl(-1);   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());   inline int rand(int l, int r) {     return uniform_int_distribution<int>(l, r)(rng);   }   inline long long rand(long long l, long long r) {     return uniform_int_distribution<long long>(l, r)(rng);   }   int p;   int i;   int xw;   long long ans = 0;   int j;   bool s1, s2;   int n, k;   struct node;   node* last;   struct node {     int sum;     node *lft, *rht;     node() {       sum = 0;       lft = NULL;       rht = NULL;     }     int query(int l) {       if (l == 2) return sum;       if (l) {         if (!rht) rht = new node();         last = rht;         if (!lft) return 0;         return lft->sum;       }       if (!lft) lft = new node();       last = lft;       if (!rht) return 0;       return rht->sum;     }     void update(int l, int r) {       if (l == r) {         sum++;         return;       }       int mid = (l + r) / 2;       if (xw <= mid) {         if (!lft) lft = new node();         lft->update(l, mid);       } else {         if (!rht) rht = new node();         rht->update(mid + 1, r);       }       sum++;     }   };   node* r = new node();   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout << setprecision(10);     cin >> n >> k;     xw = 0;     r->update(0, 1073741823);     for (i = 1; i < n + 1; ++i) {       cin >> p;       last = r;       p ^= xw;       for (j = 29; j >= 0; --j) {         s1 = ((1 << j) & k);         s2 = (1 << j) & p;         if (s1 && s2) {           if (!last->lft) break;           last = last->lft;         } else if (s1 && !s2) {           if (!last->rht) break;           last = last->rht;         } else if (s2) {           ans += last->query(1);         } else {           ans += last->query(0);         }       }       if (j == -1) ans += last->query(2);       xw = p;       r->update(0, 1073741823);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, a[2005], b[2005], x = 0, y = 0, n, m, sum = 0;     cin >> n;     for (i = 0; i < n; i++) {       cin >> m;       if (m % 2 == 0) {         a[x] = m;         x++;       } else {         b[y] = m;         y++;       }     }     sort(a, a + x, greater<int>());     sort(b, b + y, greater<int>());     if (x == y || x + 1 == y || y + 1 == x) {       cout <<  0  << endl;     } else {       if (x > y) {         for (i = y + 1; i < x; i++) {           sum += a[i];         }       }       if (x < y) {         for (i = x + 1; i < y; i++) {           sum += b[i];         }       }       cout << sum << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     char a[200005];     cin >> a;     for (int i = 0; a[i] !=   0 ; ++i) {       if (i && a[i - 1] == a[i]) {         if (a[i - 1] !=  x  && a[i + 1] !=  x )           a[i] =  x ;         else if (a[i - 1] !=  y  && a[i + 1] !=  y )           a[i] =  y ;         else           a[i] =  z ;       }     }     cout << a << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename X>   void MA(X& a, X b) {     a = max(a, b);   }   template <typename X>   void MI(X& a, X b) {     a = min(a, b);   }   template <typename X>   void clr(X& x, int a) {     memset(x, a, sizeof(x));   };   int cond = 0, multi = 0, gcj = 0;   int N;   const int MAXN = 111;   vector<array<int, 2> > ED[MAXN];   long double wsp[MAXN];   array<int, 3> res[MAXN];   int numkr = 0;   void go(int u, int p, long double val) {     int kr = 0;     kr += ED[u].size();     {       if (cond)         cerr << 38 <<                  <<  u <<     << kr <<     << val               <<     << u <<     << kr <<     << val << endl;     };     val += 2.0 / kr;     while (val >= 2.0) val -= 2.0;     for (array<int, 2> ed : ED[u])       if (ed[0] != p) {         int v = ed[0];         int idx = ed[1];         {           if (cond)             cerr << 45 <<                      <<  u <<     << v <<     << val                   <<     << u <<     << v <<     << val << endl;         };         go(v, u, 1 + val);         if (val <= 1.0) {           res[numkr] = array<int, 3>({v, u, idx});           wsp[numkr] = 1.0 - val;         } else {           res[numkr] = array<int, 3>({u, v, idx});           wsp[numkr] = 2.0 - val;         }         numkr++;         val += 2.0 / kr;         while (val >= 2.0) val -= 2.0;       }   }   void solve() {     cin >> N;     for (auto i = (1); i <= (N - 1); ++i) {       int u, v;       cin >> u >> v;       ED[u].push_back(array<int, 2>({v, i}));       ED[v].push_back(array<int, 2>({u, i}));     }     go(1, -1, 0);     cout << N - 1 <<   n ;     for (auto i = 0; i < (N - 1); ++i) {       cout << 1 <<     << res[i][2] <<     << res[i][0] <<     << res[i][1] <<                << wsp[i] <<   n ;     }   }   int main(int argc, char** argv) {     ios::sync_with_stdio(false), cin.tie(0),         cond = argc >= 2 && argv[1][0] ==  q  ? 1 << 30 : 0;     cout.setf(ios::fixed), cout.precision(10);     int t;     if (multi || gcj)       cin >> t;     else       t = 1;     for (auto i = (1); i <= (t); ++i) {       if (cond) cerr << 84 <<     << i << endl;       if (gcj) cout <<  Case #  << i <<  :  ;       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool comp(const pair<int, int> &a, const pair<int, int> &b) {     return (a.second < b.second);   }   long long gcd(long long a, long long b) {     if (!b) return a;     return gcd(b, a % b);   }   int main() {     long long n, k;     cin >> n >> k;     long long lx[43];     if (k == 1)       cout <<  Yes n ;     else {       if (k > 42ll)         cout <<  No n ;       else {         lx[1] = 1;         for (long long i = 2; i < 43; i++) {           lx[i] = lx[i - 1] * (i / gcd(lx[i - 1], i));         }         if ((n + 1) % lx[k] == 0)           cout <<  Yes n ;         else           cout <<  No n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long get(long long r) { return (r + 1) * r / 2; }   long long sumto(long long r, int need) {     long long pw = 1;     long long sum = 0;     long long add = 0;     for (int len = 1;; ++len) {       if (pw * 10 - 1 < r) {         long long cnt = pw * 10 - pw;         if (need) {           sum += add * cnt + get(cnt) * len;           add += cnt * len;         } else {           sum += cnt * len;         }       } else {         long long cnt = r - pw + 1;         if (need) {           sum += add * cnt + get(cnt) * len;         } else {           sum += cnt * len;         }         break;       }       pw *= 10;     }     return sum;   }   int main() {     int q;     cin >> q;     while (q--) {       long long k;       cin >> k;       --k;       long long l = 1, r = 1e9;       long long res = -1;       while (r - l >= 0) {         long long mid = (l + r) >> 1;         if (sumto(mid, 1) > k) {           res = mid;           r = mid - 1;         } else {           l = mid + 1;         }       }       k -= sumto(res - 1, 1);       l = 1, r = res;       long long num = -1;       while (r - l >= 0) {         int mid = (l + r) >> 1;         if (sumto(mid, 0) > k) {           num = mid;           r = mid - 1;         } else {           l = mid + 1;         }       }       cout << to_string(num)[k - sumto(num - 1, 0)] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ans, b, a, f, s, k, ss;   int main() {     cin >> a >> b;     if (a == b) {       cout <<  infinity ;       return 0;     }     if (a < b) {       cout << 0;       return 0;     }     for (int i = 1; i <= round(sqrt(a - b)); i++) {       if ((a - b) % i == 0) ans++;       if (((a - b) % i == 0 && i <= b)) s++;       if ((a - b) % i == 0 && (a - b) / i <= b) s++;     }     ans *= 2;     if (round(sqrt(a - b)) * round(sqrt(a - b)) == a - b) {       ans--;       if (round(sqrt(a - b)) <= b) s--;     }     ans -= s;     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     int n, m = 0, sum = 0;     cin >> n;     string s;     getline(cin, s);     getline(cin, s);     for (int i = 0; i < n; i++) {       if (s[i] ==    ) {         m = max(m, sum);         sum = 0;       }       if (s[i] >=  A  && s[i] <=  Z ) sum++;     }     m = max(m, sum);     cout << m;   }
#include <bits/stdc++.h>   using namespace std;   long long a, b, n;   long long vet[2000010];   bool comp(long long l, long long maior, long long meio, long long m,             long long t) {     if (a + ((meio - 1) * b) > t) return false;     if (vet[meio] - vet[l - 1] > m * t) return false;     return true;   }   int main() {     cin >> a >> b >> n;     for (int i = 0; i < 2000008; ++i) {       if (i == 0) {         vet[i] = 0;       } else {         vet[i] = ((a) + (i - 1) * b) + vet[i - 1];       }     }     for (int i = 0; i < n; ++i) {       long long l, t, m;       cin >> l >> t >> m;       long long menor = l, maior = t + 5, meio;       while (menor <= maior) {         meio = (maior + menor) / 2;         if (comp(l, maior, meio, m, t))           menor = meio + 1;         else           maior = meio - 1;       }       if (maior < l)         cout <<  -1  << endl;       else         cout << maior << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int v[26][N];   int main() {     int n;     cin >> n;     string s;     for (int i = 0; i < n; ++i) {       cin >> s;       for (int j = 0; j < s.size(); j++)         if (s[j] !=  ? ) v[s[j] -  a ][j]++;     }     string ans =   ;     int pos = 0;     for (int i = 0; i < s.size(); ++i) {       int may = 0;       for (int j = 0; j < 26; j++) {         if (may < v[j][i]) {           may = v[j][i];           pos = j;         }       }       int a1 = 0;       bool flag = 0;       char x =  * ;       for (int j = 0; j < 26; j++) {         if (may == v[j][i] or (v[j][i] != may && v[j][i])) a1++, flag = 1;         if (flag && !v[j][i]) {           if (a1 <= 1) x = j;           flag = 0;         }       }       if (a1 == 1)         ans += char(pos) +  a ;       else {         if (may != 0)           ans +=  ? ;         else           ans += char(x) +  a ;       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 998244353;   long long exp(long long n, long long m, long long md) {     long long a = 1;     while (m > 0) {       if (m & 1) a = (a * n % md) % md;       m /= 2;       n = (n * n) % md;     }     return a % md;   }   long long R = MOD;   long long modInverse(long long n) { return exp(n, R - 2, R); }   long long ncr(long long n, long long r) {     if (r == 0) return 1;     vector<long long> fac(n + 1, 1);     for (long long i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % R;     return ((fac[n] * modInverse(fac[r]) % R) * modInverse(fac[n - r]) % R) % R;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long n, k;     cin >> n >> k;     if (k > n)       cout << 0 <<   n ;     else if (k == 1)       cout << n <<   n ;     else {       long long ans = 0;       for (long long i = 1; i * k <= n; i++) {         ans += ncr(n / i - 1, k - 1);         ans %= R;       }       cout << ans <<   n ;     }   }