func_code_string: #include <bits/stdc++.h>   using namespace std;   int32_t main() {     ios::sync_with_stdio(false);     cout.tie(0);     cin.tie(0);     long long t;     cin >> t;     while (t--) {       long long n, m, k;       cin >> n >> m >> k;       long long cnt = n / k;       if (m <= cnt)         cout << m <<   n ;       else {         long long cntt = (m - cnt + k - 2) / (k - 1);         cout << (cnt - cntt) <<   n ;       }     }     return 0;   }   