Finding a reason for different runtimes

Pasted below are two solutions to the same problem MATBREAK. Can someone help me demystify why one is faster than the other ?
https://www.codechef.com/viewsolution/32037109
https://www.codechef.com/viewsolution/32132442
First one is user @alphatrance1 's solution which I looked up post contest and the other one is mine. I am just thinking if I missed any subtle trick here.

Thanks :slight_smile:

I don’t think so. In fact, CodeChef had announced that they will be using online cloud checkers for check the solution which may vary the time limit by a few milliseconds. Maybe it is because of that your code got 0.04s.

1 Like

please help!!
question https://www.codechef.com/problems/FLOW002
my answer
#include
#include
using namespace std;
int func(int a, int b)
{
int sol=a%b;
return sol;
}
int main()
{
int T;
cin>>T;
for(int i=0;i<T;i++)
{
int a,b;
cin>>a>>b;
cout<<func(a,b)<<endl;
}
return 0;
}
it is showing compilation error ( consider me as an absolute beginner , please help!!)