My code shows rumtime error SIGSEGV in codechef but it runs smoothly in VS code.

#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b)
{
if(b>a)
gcd(b,a);
else if(b==0)
return a;
else
gcd(b,a%b);
}
int main() {
// your code goes here
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t–)
{
long long n,k,l,g,ans;
cin>>n>>k;
//if(k>n)
g=gcd(n,k);
l=((n/g)*(k/g)*g);
ans=l/k;
cout<<ans<<"\n";
//cout<<“h”;
}
return 0;
}

Attach submission link