My issue
resolve the time limit issue in this…
My code
#include <iostream>
#define ll long long int
using namespace std;
ll total_candies(ll x,ll y){
if(x==y ){
return x+y;
}
else if(x==0 && y>0){
return y;
}
else if(y==0 && x>0){
return x;
}
else{
if(x>y){
return total_candies(x-y,y);}
else if(x<y){
return total_candies(x,y-x);}
}
}
int main() {
// your code goes here
ll t;
cin>>t;
while(t--){
ll x,y;
cin>>x>>y;
cout<<total_candies(x,y)<<endl;
}
return 0;
}
Problem Link: SINS Problem - CodeChef