Help me in solving APPLEORANGE problem

My issue

What is wrong with this code?

My code

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	// your code goes here
	int t;
	for(int i=1;i<t+1;i++){
	    int a,o;
	    int c=min(a,o);
	    int max_no=1;
	    for(int j=2;j<=c;j++){
	        if(a%j==0 && o%j==0){
	return 0;

Problem Link: APPLEORANGE Problem - CodeChef

Since u have to find the gcd of a and o .
and constraints of a and o is very high so your logic will give u tle.
but gcd can be computed in log(n) time complexity too.
just google it u will find the relevant articles.