Help me in solving SMOL problem

My issue

I already solve the problem but there is showing run time error .why this is happen I didn’t understand . Anyone can help me?

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
    int t,n,k;
    cin>>t;
    while(t--){
        cin>>n>>k;
        cout<<n%k<<endl;
    }
    return 0;
}

Learning course: Level up from 1* to 2*
Problem Link: Smallest Possible Whole Number Practice Problem in Level up from 1* to 2* - CodeChef

@sk_nur_ahmad
plzz refer the following code

#include <bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
long long int  t;
cin>>t;
while(t--){
long long int n,k;
cin>>n>>k;
if(n>=k&&k!=0){
    long long int ans=n%k;
cout<<ans<<endl;
}
else cout<<n<<endl;
}
return 0;
}

thank you