Help me in solving LBC20 problem

My issue

My code

// Update the code below to solve this problem

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

int main() 
{
  int t;
  cin>>t; 
  while(t--)
  {
  int X, Y;
  cin>>X>>Y;
  int sum = X + Y;
  int problemA = 500, problemB = 1000;
  int ansA = 500 - X * 2;
  int ansB = 1000 - sum * 4;
  int finalAns = ansA + ansB;
  
  
  //If Chef attempts in the order  B → A then he submits Problem B > A 
  int ansA1 = 1000 - X * 4;
  int ansB1 = 500 - sum * 2;
  int finalAns1 = ansA1 + ansB1;
  
 cout << ceil(finalAns) << endl;

   }
return 0;
}

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

@ujwalgulhane31

I think 2 errors in your code

  1. cout << ceil(finalAns) << endl; is incorrect. What should it be? You want to output the max of finalans and finalans1 right?
  2. int ansA1 = 1000 - X * 4; is incorrect. What should it be? What is the time required to solve the question with 1000 points?