Limits 1s, 32 MB

“Don’t practice until you get it right. Practice until you can’t get it wrong”

Bangladesh is the host country for the 45th45^{th} Annual ICPC World Finals 2021.

For a successful event arrangement, a volunteer training program has been arranged with many trainees. The season was full of some activities like leadership, fundamental skills of volunteers, problem-solving, decision-making, and different challenges of volunteering, etc. All the trainees were very attentive and took part in the activities spontaneously.

At the end of the event, snacks will be provided for everyone. Opera is the organizer of the food distribution system. Currently, she has MM dollars for food expenses.  But she is not sure how many people will come for the snacks, so she wants to buy as many as snacks with the money she has for safety. Fortunately, a Buy 2 Get 1 Offer is running on pizza in a nearby shop. That means-

“If you purchase 22 pizzas then you will get 11 pizza for free”.

The price of one (1) mini-size 66-inch pizza is XX dollars.

Write a program to determine the maximum number of pizzas she can purchase from that shop. She can buy a pizza if and only if the total cost after purchasing that pizza does not exceed the dollar she has.


The first line of the input contains TT - the number of test cases. Then the following TT lines contain two integers MM and XX separated by spaces.

1<=T<=501 <= T <= 50

1<=M,X<=1031 <= M, X <= 10^{3}


Output a single integer for each test case, the maximum number of pizzas Opera can purchase.


1000 250
515 250


Login to submit.


92% Solution Ratio
steinumEarliest, Dec '22
user.3193Fastest, 0.0s
Monjurul.9781Lightest, 4.9 MB
ItzRAYShortest, 93B
Toph uses cookies. By continuing you agree to our Cookie Policy.