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 ?
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!!
my answer
using namespace std;
int func(int a, int b)
int sol=a%b;
return sol;
int main()
int T;
for(int i=0;i<T;i++)
int a,b;
return 0;
it is showing compilation error ( consider me as an absolute beginner , please help!!)