# Help me to understand why i got TLE in tuple problem

my code is :

``````#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

int main() {
int t;
scanf("%d",&t);
while(t--)
{
long long int totalmoves=0,i,j,flag=1;
long long  int orig[3],final[3];
int arr[2];
arr[0]=0;arr[1]=0;
long long int sum1=0,sum2=0;

for(i=0;i<3;i++)
{
scanf("%lld",&orig[i]);
sum1+=orig[i];
}
for(i=0;i<3;i++)
{
scanf("%lld",&final[i]);
sum2+=final[i];
}

while(sum1<sum2)
{

/*  if(sum2-sum1==final[0]-orig[0]  || sum2-sum1==final[1]-orig[1]  || sum2-sum1==final[2]-orig[2])
{
printf("%lld\n", totalmoves+1);
flag=0;
break;
}
*/
sum1=0;
for(i=0;i<3;i++)
{
if(orig[i] != 0)
{
if(final[i]/orig[i] > 1 )
arr[1]++;
else
arr[0]++;
}
else
arr[0]++;
}

if(arr[0]>arr[1])
{
long long int min_of_all=INT_MAX,diff[3];
diff[0]=diff[1]=diff[2]=INT_MAX;

for(int o=0;o<3;o++)
{
if(orig[o]!=final[o] && final[o]!=0 )
{
diff[o]=final[o]-orig[o];
}
min_of_all=min(min_of_all,diff[o]);
}

for(int k=0;k<3;k++)
{
if(orig[k]!=final[k] && orig[k]+min_of_all<=final[k])
{
orig[k]=orig[k]+min_of_all;
}
sum1+=orig[k];
}

totalmoves++;

}
else
{
long long int divi[3],min_of_alldiv=INT_MAX;
divi[0]=divi[1]=divi[2]=INT_MAX;

for(int l=0;l<3;l++)
{
if(final[l]!=0 && orig[l] != 0 && final[l]/orig[l]!=1 )
{
divi[l]=final[l]/orig[l];
}
min_of_alldiv=min(min_of_alldiv,divi[l]);
}

for(int b=0;b<3;b++)
{
if(final[b]!=0 && orig[b] != 0 && final[b]/orig[b]!=1 )
{
orig[b]=orig[b]*min_of_alldiv;
}
sum1+=orig[b];
}
totalmoves++;
}

if((sum1 ==sum2) && flag==1)
{
printf("%lld\n", totalmoves);
break;
}
}
}
return 0;
}``````

can you share the link to your submission so that we can see where you have got TLE