Gift rift is giving wrong answer

Below is the link to problem:

Below is my code ,i want to know in which case its failing.

#include<iostream>
#include<cstdio>
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);


using namespace std;

int main()
{
	FAST_IO

unsigned long int R,C;
cin>>R>>C;
unsigned long long int Arr[R][C],smallest_index,largest_index,largest_value,flag=0,r,prev_largest_value,max=0,min=100000001  ;

for(int i=0;i<R;i++)
{
	for(int j=0;j<C;j++)
		cin>>Arr[i][j];

}

for(int i=0;i<C;i++)
{
	flag=0;
	
	max=0;min=100000001 ;
	
	for(int j=0;j<R;j++)
	{
		if(Arr[j][i]>max)
		{
			max=Arr[j][i];
			largest_index=j;
		}

	}
	
	for(int j=0;j<C;j++)
	{
	
		if(Arr[largest_index][j]<=min)
		{
			min=Arr[largest_index][j];
		    //smallest_index=j;
		}
	
	}

	if(min==max)
	{
		flag=1;	
	    break;
	}

}

if(flag==1)
	cout<<max<<"\n";
else
	cout<<"GUESS"<<"\n";


    return 0;
}



Consider the testcase:

2 3
37 2 24
37 97 75
1 Like