Help me in solving LBC20 problem

My issue

I am writing the perfect code of the given question but when I submit the code then output is showing wrong

My code

// Update the code below to solve this problem

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

int main() 
{
  int t;
  cin>>t; 
  while(t--)
  {
  int X, Y;
  cin>>X>>Y;
  if(X<Y){
      cout<<(500-X*2)+(1000-(X+Y)*4)<<endl;
  }
  else{
      cout<<(1000-Y*4)+(500-(X+Y)*2)<<endl;
  }
  
   }
return 0;
}

Learning course: Solve Programming problems using C++
Problem Link: CodeChef: Practical coding for everyone

@rs83050583
U have to compare the values and then print the max among them.
Like this.

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

int main() 
{
  int t;
  cin>>t; 
  while(t--)
  {
  int X, Y;
  cin>>X>>Y;
  int val1=(500-X*2)+(1000-(X+Y)*4);
  int val2=(1000-Y*4)+(500-(X+Y)*2);
  if(val1>val2)
  cout<<val1;
  else
  cout<<val2;
  cout<<endl;
  
   }
return 0;
}