Help me in solving LBC20 problem

My issue

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;
  int p1=500,p2=1000;
    if(X<Y)
    {
        p1= p1 - 2*X;
        p2 = p2 - 4*X - 4*Y;
    }
    else
    {
        p2 = p2 - 4*Y;
        p1  = p1 - 2*Y  - 2*X;
    }
    cout << p1+p2<<endl;
   }
return 0;
}

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

@arunyagurjar
Actually to have to explore all possibility and then print max among them .
So u don’t have to put the condition like x>y n all.
i have edited your code hope u will get it.

#include <bits/stdc++.h>
#include <string>
using namespace std;

int main() 
{
  int t;
  cin>>t; 
  while(t--)
  {
  int X, Y;
  cin>>X>>Y;
  int p1=500,p2=1000,p3=500,p4=1000;
        p1= p1 - 2*X;
        p2 = p2 - 4*X - 4*Y;
        p4 = p4 - 4*Y;
        p3  = p3 - 2*Y  - 2*X;
    cout << max(p1+p2,p3+p4)<<endl;
   }
return 0;
}