*Author:* noob_tech

*Tester:* noob_tech

*Editorialist:* noob_tech

# DIFFICULTY:

CAKEWALK, SIMPLE, EASY.

# PREREQUISITES:

Math .

# PROBLEM:

CodeMaster and Chef has bank balance M and N (Rupees) respectively. It’s guaranteed that CodeMaster bank balance is smaller than or equal to his friend chef’s bank balance.

CodeMaster invests a lot in share market and his bank balance is tripled after every year, while chef’s bank balance doubled after every year.

After how many years will CodeMaster’s bank balance become strictly equal to chef’s bank balance?

If it is possible that the CodeMaster’s bank balance is strictly equal to chef’s bank balance then print YES else Print NO.

# QUICK EXPLANATION:

Consider N=4 (CodeMaster’s bank balance) ans M=9 (chef’s bank balance). CodeMaster’s and chef’s bank balance in next years are: 12 rupees and 18 rupees(after one year), then 36 and 36 rupees(after two year).

After two year CodeMaster’s bank balance is equal to Chef’s bank balance.

So output will be YES.

# EXPLANATION:

We are given CodeMaster’s and Chef’s bank balance N and M rupees respectively.

Also given N will be less than or equal to M.

After every year CodeMaster’s bank balance tripled ans Chef’s bank balance doubled. We have to check,Will CodeMaster’s bank balance and Chef’s bank balance stricly be equal.

IF the balance of both of them will be equal then print YES else NO.

# SOLUTIONS:

## Setter's Solution

#include< iostream>

using namespace std;

int main()

{

int t;

cin >> t;

while (t- -)

{

int a, b, d = 0;

cin >> a >> b;

if (a == b)

{

cout << “YES” << endl;

}

else

{

while (a < b)

{

a = a * 3;

b = b * 2;

if (a == b)

{

d = 1;

cout << “YES” << endl;

break;

}

}

if (d == 0)

{

cout << “NO” << endl;

}

}

}

return 0;

}

## Tester's Solution

#include< iostream>

using namespace std;

int main()

{

int t;

cin >> t;

while (t- -)

{

int a, b, d = 0;

cin >> a >> b;

if (a == b)

{

cout << “YES” << endl;

}

else

{

while (a < b)

{

a = a * 3;

b = b * 2;

if (a == b)

{

d = 1;

cout << “YES” << endl;

break;

}

}

if (d == 0)

{

cout << “NO” << endl;

}

}

}

return 0;

}

## Editorialist's Solution

#include< iostream>

using namespace std;

int main()

{

int t;

cin >> t;

while (t- -)

{

int a, b, d = 0;

cin >> a >> b;

if (a == b)

{

cout << “YES” << endl;

}

else

{

while (a < b)

{

a = a * 3;

b = b * 2;

if (a == b)

{

d = 1;

cout << “YES” << endl;

break;

}

}

if (d == 0)

{

cout << “NO” << endl;

}

}

}

return 0;

}