Help me in solving SMOL problem

My issue

explain the problem

My code

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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    long long int N,K;
	    cin>>N>>K;
	    if(N<K){
	        cout<<N<<endl;
	    }else{
	        cout<<N-(N/K)*K<<endl;
	    }
	   // int res;
	   // while(N>=0){
	   //     res=N;
	   //     N-=K;
	   // }
	   // cout<<res<<endl;
	}

}

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

@kondurusai863
plzz refer my c++ code for better understanding of the logic

#include <iostream>
using namespace std;

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

thank you