func_code_string: #include <bits/stdc++.h>   using namespace std;   using lld = signed long long int;   lld solve() {     lld n, m, k;     cin >> n >> m >> k;     lld x = n / k;     if (m <= x) return m;     if (m <= x + (k - 1)) return x - 1;     return x - ceil((m - x) / (k - 1.0));   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       cout << solve() <<   n ;     }     return 0;   }   