Help me in solving YOGACLASS problem

My issue

int n;
cin>>n;
//int income=0;

int N,X,Y;
for(int i=0;i<n;i++){
    cin>>N>>X>>Y;
    int income=0;

if(N%2==0){
   income=N*X;
}
else{
int hour2=N/2;
int hour1=N-2*hour2;
income=(hour2*Y) + (hour1*X);
  }
cout<<income<<endl;
}
return 0;

its not taking all test cases

My code

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	//int income=0;
	
	int N,X,Y;
	for(int i=0;i<n;i++){
	    cin>>N>>X>>Y;
	    int income=0;
	
	if(N%2==0){
	   income=N*X;
	}
	else{
	int hour2=N/2;
	int hour1=N-2*hour2;
	income=(hour2*Y) + (hour1*X);
      }
    cout<<income<<endl;
	}
    return 0;
}

Problem Link: Yoga Class Practice Coding Problem

@tanmay_rajput
plzz refer the following solution

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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n,x,y;
	    cin>>n>>x>>y;
	    if(2*x>=y)
	    cout<<n*x;
	    else
	    {
	        if(n%2==0)
	        cout<<(n/2)*y;
	        else
	        {
	            cout<<(((n-1)/2)*y)+x;
	        }
	    }
	    cout<<endl;
	}

}