## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Joining Date CodeChef Solution | CodeChef Problem Solution 2022

$N$ candidates (numbered from $1$ to $N$) join Chef's firm. The first $5$ candidates join on the first day, and then, on every subsequent day, the next $5$ candidates join in.
For example, if there are $12$ candidates, candidates numbered $1$ to $5$ will join on day $1$, candidates numbered $6$ to $10$ on day $2$ and the remaining $2$ candidates will join on day $3$.

Candidate numbered $K$ decided to turn down his offer and thus, Chef adjusts the position by shifting up all the higher numbered candidates. This leads to a change in the joining day of some of the candidates.

Help Chef determine the number of candidates who will join on a different day than expected.

### Input Format

• First line will contain $T$, number of test cases. Then the test cases follow.
• Each test case contains of a single line of input, two space-separated integers $N$ and $K$ denoting the number of candidates and the candidate who turned down the offer.

### Output Format

For each test case, output a single integer denoting the number of candidates whose joining day

Burgers CodeChef Solution

Waiting Time CodeChef Solution

DNA Storage CodeChef Solution

Joining Date CodeChef Solution

Distinct Palindrome CodeChef Solution

The Optimal Pairs CodeChef Solution

Make them Equal CodeChef Solution

Permutation AND CodeChef Solution

will be changed.

### Constraints

• $1\le T\le 1000$
• $2\le N\le 1000$